Fixed null pointer exception in ShowScriptEditor when script component has no instance

This commit is contained in:
Simon Lübeß
2023-12-01 23:14:51 +01:00
parent 270e34b983
commit 48cdcee8a8
+5 -2
View File
@@ -809,8 +809,9 @@ static class ScriptEngine
public static void ShowScriptEditor(Entity entity, ScriptComponent* scriptComponent)
{
let method = s_EntityEditor.GetMethod("ShowDefaultEntityEditor", 2);
if (scriptComponent.Instance == null)
return;
ScriptClass scriptClass = ScriptEngine.GetScriptClass(scriptComponent.ScriptClassName);
if (scriptClass == null)
@@ -823,6 +824,8 @@ static class ScriptEngine
#unwarn
void*[2] args = .(&entityId, monoReflectionType);
let method = s_EntityEditor.GetMethod("ShowDefaultEntityEditor", 2);
s_EntityEditor.Invoke(method, null, &args);
}