From d061b84e01761cd11a6203caa47e928bd3a4a0d1 Mon Sep 17 00:00:00 2001 From: Kah Wei Date: Fri, 10 Mar 2023 19:24:38 +0800 Subject: [PATCH 1/2] Added extra check to handle null assemblies when collecting script assemblies --- SHADE_Managed/src/Scripts/ScriptStore.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SHADE_Managed/src/Scripts/ScriptStore.cxx b/SHADE_Managed/src/Scripts/ScriptStore.cxx index 5d3a3bac..d1931c59 100644 --- a/SHADE_Managed/src/Scripts/ScriptStore.cxx +++ b/SHADE_Managed/src/Scripts/ScriptStore.cxx @@ -882,6 +882,8 @@ namespace SHADE System::Collections::Generic::IEnumerable^ selectorFunc(System::Reflection::Assembly^ assembly) { + if (assembly == nullptr) + return nullptr; return assembly->GetExportedTypes(); } Pair^ resultSelectorFunc(System::Reflection::Assembly^ assembly, System::Type^ type) From 47621d743696a4f801d89774be318ab4ba1af5f9 Mon Sep 17 00:00:00 2001 From: Kah Wei Date: Fri, 10 Mar 2023 22:37:27 +0800 Subject: [PATCH 2/2] Added extra line to log an error if a null assembly is detected --- SHADE_Managed/src/Scripts/ScriptStore.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SHADE_Managed/src/Scripts/ScriptStore.cxx b/SHADE_Managed/src/Scripts/ScriptStore.cxx index d1931c59..9ef447bf 100644 --- a/SHADE_Managed/src/Scripts/ScriptStore.cxx +++ b/SHADE_Managed/src/Scripts/ScriptStore.cxx @@ -883,7 +883,10 @@ namespace SHADE System::Collections::Generic::IEnumerable^ selectorFunc(System::Reflection::Assembly^ assembly) { if (assembly == nullptr) + { + Debug::LogError("[ScriptStore] Received null assembly while collecting Script types. This should not happen!"); return nullptr; + } return assembly->GetExportedTypes(); } Pair^ resultSelectorFunc(System::Reflection::Assembly^ assembly, System::Type^ type)