mirror of
https://github.com/opensim/opensim.git
synced 2026-07-31 22:05:36 +08:00
try improve lsl list compare with null, hopefuly not looping for ever
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user