refactor: "temporary" fix for MapScenePresenter has many NRE issues during run the CI

This commit is contained in:
alexiscatnip
2022-08-06 02:43:06 +08:00
committed by alexiscatnip
parent d1f96ed3b8
commit a1ae85d21e
@@ -81,6 +81,10 @@ namespace Raindrop.UI.map.Map_SceneHierachy
RegisterClientEvents();
}
public void OnApplicationQuit()
{
UnregisterClientEvents(Client);
}
void RegisterClientEvents()
@@ -147,8 +151,15 @@ namespace Raindrop.UI.map.Map_SceneHierachy
if (e is null)
{
Debug.LogWarning("e is null");
return;
}
MapSceneData.regions[e.Region.RegionHandle] = e.Region;
if (MapSceneData.regions is null)
{
Debug.LogWarning("MapSceneData.regions is null");
return;
}
// this is causing some NRE
// MapSceneData.regions[e.Region.RegionHandle] = e.Region;
if (e.Region.Access != SimAccess.NonExistent
&& e.Region.MapImageID != UUID.Zero
&& !tileRequests.Contains(e.Region.RegionHandle)
@@ -192,6 +203,10 @@ namespace Raindrop.UI.map.Map_SceneHierachy
return;
}
// case: app is already closed.
if (!UnityMainThreadDispatcher.Exists())
return;
UnityMainThreadDispatcher.Instance().Enqueue(
() =>
{