mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Data model conditions - Fixed default values for value types not being applied
This commit is contained in:
parent
eb1c99a944
commit
a79223fa75
@ -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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user