From 8ed0680bb9726a2290b1df644f46df30048fc67d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 6 Nov 2019 23:40:53 +0000 Subject: handle null refs on llSubStringIndex() --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8ddd175..d4cbbce 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5846,6 +5846,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llSubStringIndex(string source, string pattern) { m_host.AddScriptLPS(1); + if (string.IsNullOrEmpty(source)) + return -1; + if (string.IsNullOrEmpty(pattern)) + return 0; return source.IndexOf(pattern); } -- cgit v1.1