Merge pull request #162 from meziantou/nre-CssOriginValue
Fix nullable reference exception in CssOriginValue
This commit is contained in:
Коммит
102cc320ee
|
@ -2,6 +2,7 @@ namespace AngleSharp.Css.Values
|
|||
{
|
||||
using AngleSharp.Css.Dom;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a CSS origin definition.
|
||||
|
@ -73,14 +74,20 @@ namespace AngleSharp.Css.Values
|
|||
/// <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);
|
||||
if (other is not null)
|
||||
{
|
||||
var comparer = EqualityComparer<ICssValue>.Default;
|
||||
return comparer.Equals(_x, other._x) && comparer.Equals(_y, other._y) && comparer.Equals(_z, other._z);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче