Skip to content

Commit cfd50e3

Browse files
committed
ReferenceValue EqualCondition fix
1 parent 384af49 commit cfd50e3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ValueSystem/ReferenceValue.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ public class ReferenceValue(object? value) : Value
88
public bool IsValid => value is not null;
99
public object Value => value ?? throw new ScriptRuntimeError("Value of reference is invalid.");
1010

11-
public override bool EqualCondition(Value other) => other is ReferenceValue otherP && Value.Equals(otherP.Value);
11+
public override bool EqualCondition(Value other)
12+
{
13+
if (other is not ReferenceValue otherP || !IsValid || !otherP.IsValid) return false;
14+
return Value.Equals(otherP.Value);
15+
}
1216

1317
public override string ToString()
1418
{

0 commit comments

Comments
 (0)