mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Data model conditions - Fixed default values for value types not being applied
This commit is contained in:
1 parent
eb1c99a944
commit
a79223fa75
2 files changed
+8
-7
No files matched your search
+3
-3
@@ -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);
|
||||
}
|
||||
|
||||
+5
-4
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user