Skip to content

Commit

Permalink
fix: BaseControl: Null reference when view model is null.
Browse files Browse the repository at this point in the history
  • Loading branch information
GregaMohorko committed Apr 12, 2021
1 parent e7f3b77 commit c0e64d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/GM.WPF/GM.WPF/Controls/BaseControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ protected static DependencyProperty DependencyVMProperty<TOwner, TViewModel>(str
}

/// <summary>
/// Creates a dependency property that, when updated, will also update the value in the view model.
/// Creates a dependency property that, when updated, will also update the value of a property in the view model.
/// </summary>
/// <param name="name">The name of the dependency property.</param>
/// <param name="ownerType">The type of the control.</param>
Expand Down Expand Up @@ -530,7 +530,7 @@ void propertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventA
void setPropertyWithoutNullifyingWhenParentTabItemIsNotSelected()
{
// sets the new value of the property to the property in the view model
baseControl.ViewModel.SetProperty(viewModelPropertyName, e.NewValue);
baseControl.ViewModel?.SetProperty(viewModelPropertyName, e.NewValue);
}

if(!nullifyWhenParentTabItemIsNotSelected) {
Expand Down

0 comments on commit c0e64d5

Please sign in to comment.