1
0
Fork 0
4Creative-Changes/CurrentPatches/0001-dont-cast-LSL_Integer-...

44 lines
1.9 KiB
Diff
Raw Normal View History

2021-02-06 17:17:28 +00:00
From e3aa335948fda8a6558c9407847e8d9e976790cd Mon Sep 17 00:00:00 2001
From: Chris <christopher@clatza.dev>
Date: Sat, 6 Feb 2021 18:14:20 +0100
Subject: [PATCH] dont cast LSL_Integer to int in osGetNumberOfAttachments.
---
.../Shared/Api/Implementation/OSSL_Api.cs | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 2c6f1e44cc..680b84d732 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -4278,21 +4278,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
foreach (object point in attachmentPoints.Data)
{
- LSL_Integer ipoint = new LSL_Integer(
- (point is LSL_Integer || point is int || point is uint) ?
- (int)point :
- 0
- );
- resp.Add(ipoint);
- if (ipoint == 0)
+ if (int.TryParse(point.ToString(), out int ipoint))
{
- // indicates zero attachments
- resp.Add(new LSL_Integer(0));
+ resp.Add(ipoint);
+ resp.Add(new LSL_Integer(target.GetAttachments((uint)ipoint).Count));
}
else
{
- // gets the number of attachments on the attachment point
- resp.Add(new LSL_Integer(target.GetAttachments((uint)ipoint).Count));
+ resp.Add(new LSL_Integer(0));
+ resp.Add(new LSL_Integer(0));
}
}
}
--
2.29.2.windows.3