try improve lsl list compare with null, hopefuly not looping for ever

This commit is contained in:
UbitUmarov
2022-05-04 19:24:16 +01:00
parent a1e32e37da
commit df03e64f5c
3 changed files with 24 additions and 35 deletions

View File

@@ -679,7 +679,10 @@ namespace OpenSim.Region.ScriptEngine.Shared
get
{
if (m_data == null)
{
m_data=new object[0];
return 0;
}
return m_data.Length;
}
}
@@ -923,26 +926,20 @@ namespace OpenSim.Region.ScriptEngine.Shared
public static bool operator ==(list a, list b)
{
int la = -1;
int lb = -1;
try { la = a.Length; }
catch (NullReferenceException) { }
try { lb = b.Length; }
catch (NullReferenceException) { }
return la == lb;
if (b is null)
return (a is null);
if (a is null)
return (b is null);
return a.Length == b.Length;
}
public static bool operator !=(list a, list b)
{
int la = -1;
int lb = -1;
try { la = a.Length; }
catch (NullReferenceException) { }
try { lb = b.Length; }
catch (NullReferenceException) { }
return la != lb;
if (b is null)
return !(a is null);
if (a is null)
return !(b is null);
return a.Length != b.Length;
}
public void Add(object o)