Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nullable reference exception in CssOriginValue #162

Merged
merged 2 commits into from
Feb 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/AngleSharp.Css/Values/Composites/CssOriginValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace AngleSharp.Css.Values
{
using AngleSharp.Css.Dom;
using System;
using System.Collections.Generic;

/// <summary>
/// Represents a CSS origin definition.
Expand Down Expand Up @@ -73,14 +74,17 @@ public String CssText
/// <returns>True if both are equal, otherwise false.</returns>
public Boolean Equals(CssOriginValue other)
{
return _x.Equals(other._x) && _y.Equals(other._y) && _z.Equals(other._z);
return other is not null
&& EqualityComparer<ICssValue>.Default.Equals(_x, other._x)
FlorianRappl marked this conversation as resolved.
Show resolved Hide resolved
&& EqualityComparer<ICssValue>.Default.Equals(_y, other._y)
&& EqualityComparer<ICssValue>.Default.Equals(_z, other._z);
}

ICssValue ICssValue.Compute(ICssComputeContext context)
{
var x = _x.Compute(context);
var y = _y.Compute(context);
var z = _z.Compute(context);
var x = _x?.Compute(context);
var y = _y?.Compute(context);
var z = _z?.Compute(context);

if (x != _x || y != _y || z != _z)
{
Expand Down
Loading