From c981f3c44803af98c155ffcd46ee7b036f40f96a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 11 Apr 2024 02:42:05 +0100 Subject: [PATCH] avoid a possible null ref --- OpenSim/Region/Framework/Scenes/GodController.cs | 5 ++--- ThirdParty/SmartThreadPool/SmartThreadPool.cs | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/GodController.cs b/OpenSim/Region/Framework/Scenes/GodController.cs index 388598e363..159f9c504a 100644 --- a/OpenSim/Region/Framework/Scenes/GodController.cs +++ b/OpenSim/Region/Framework/Scenes/GodController.cs @@ -240,9 +240,8 @@ namespace OpenSim.Region.Framework.Scenes if(state != null) { OSDMap s = (OSDMap)state; - - if (s.ContainsKey("ViewerUiIsGod")) - newstate = s["ViewerUiIsGod"].AsBoolean(); + if (s.TryGetValue("ViewerUiIsGod", out OSD tmp)) + newstate = tmp.AsBoolean(); m_lastLevelToViewer = m_viewergodlevel; // we are not changing viewer level by default } UpdateGodLevels(newstate); diff --git a/ThirdParty/SmartThreadPool/SmartThreadPool.cs b/ThirdParty/SmartThreadPool/SmartThreadPool.cs index d7a6a9fbc4..f5f8d5e4bc 100644 --- a/ThirdParty/SmartThreadPool/SmartThreadPool.cs +++ b/ThirdParty/SmartThreadPool/SmartThreadPool.cs @@ -846,6 +846,8 @@ namespace Amib.Threading continue; Thread thread = te.WorkThread; + if(thread is null) + continue; // Join don't work with negative numbers if (!waitInfinitely && (millisecondsLeft < 0))