diff --git a/src/Artemis.UI/Screens/ProfileEditor/Conditions/DataModelConditionListPredicateViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Conditions/DataModelConditionListPredicateViewModel.cs index 535bdb323..31ad33c2c 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Conditions/DataModelConditionListPredicateViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Conditions/DataModelConditionListPredicateViewModel.cs @@ -158,12 +158,12 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions if (RightSideInputViewModel == null) CreateRightSideInputViewModel(); - if (SelectedOperator.RightSideType.IsValueType && DataModelConditionListPredicate.RightStaticValue == null) - RightSideInputViewModel.Value = SelectedOperator.RightSideType.GetDefault(); + Type preferredType = DataModelConditionListPredicate.GetPreferredRightSideType(); + if (preferredType.IsValueType && DataModelConditionListPredicate.RightStaticValue == null) + RightSideInputViewModel.Value = preferredType.GetDefault(); else RightSideInputViewModel.Value = DataModelConditionListPredicate.RightStaticValue; - Type preferredType = DataModelConditionListPredicate.GetPreferredRightSideType(); if (RightSideInputViewModel.TargetType != preferredType) RightSideInputViewModel.UpdateTargetType(preferredType); } diff --git a/src/Artemis.UI/Screens/ProfileEditor/Conditions/DataModelConditionPredicateViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Conditions/DataModelConditionPredicateViewModel.cs index 4f1fa2f08..08ea2cb05 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Conditions/DataModelConditionPredicateViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Conditions/DataModelConditionPredicateViewModel.cs @@ -133,12 +133,13 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions if (RightSideInputViewModel == null) CreateRightSideInputViewModel(); - if (SelectedOperator.RightSideType.IsValueType && DataModelConditionPredicate.RightStaticValue == null) - RightSideInputViewModel.Value = SelectedOperator.RightSideType.GetDefault(); + Type preferredType = DataModelConditionPredicate.GetPreferredRightSideType(); + // Ensure the right static value is never null when the preferred type is a value type + if (preferredType.IsValueType && DataModelConditionPredicate.RightStaticValue == null) + RightSideInputViewModel.Value = preferredType.GetDefault(); else RightSideInputViewModel.Value = DataModelConditionPredicate.RightStaticValue; - - Type preferredType = DataModelConditionPredicate.GetPreferredRightSideType(); + if (RightSideInputViewModel.TargetType != preferredType) RightSideInputViewModel.UpdateTargetType(preferredType); }