Skip to content

Commit

Permalink
also related to #1614
Browse files Browse the repository at this point in the history
  • Loading branch information
beto-rodriguez committed Oct 15, 2024
1 parent c2d3bfe commit 8eefb6d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/LiveChartsCore/Kernel/ChartElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ protected virtual void SetPaintProperty(
bool isStroke = false,
[CallerMemberName] string? propertyName = null)
{
if (value == reference) return;
// The null check is intentional.
// we need to allow nulls to go further this if
// OnPropertyChanged needs to be called
// to detect whether the user set the null value.
if (value is not null && value == reference) return;

if (propertyName is null) throw new ArgumentNullException(nameof(propertyName));
if (!CanSetProperty(propertyName)) return;
Expand Down Expand Up @@ -127,7 +131,11 @@ protected virtual void SetProperty<T>(
T value,
[CallerMemberName] string? propertyName = null)
{
if (Equals(value, reference)) return;
// The null check is intentional.
// we need to allow nulls to go further this if
// OnPropertyChanged needs to be called
// to detect whether the user set the null value.
if (value is not null && value.Equals(reference)) return;

if (propertyName is null) throw new ArgumentNullException(nameof(propertyName));
if (!CanSetProperty(propertyName)) return;
Expand Down

0 comments on commit 8eefb6d

Please sign in to comment.