diff --git a/dGame/Entity.cpp b/dGame/Entity.cpp index 1f007746..96b89e53 100644 --- a/dGame/Entity.cpp +++ b/dGame/Entity.cpp @@ -786,6 +786,7 @@ void Entity::UpdateXMLDoc(tinyxml2::XMLDocument* doc) { CppScripts::Script* Entity::GetScript() const { auto* scriptComponent = GetComponent(); + if (!scriptComponent) return CppScripts::invalidScript.get(); auto* script = scriptComponent->GetScript(); DluAssert(script != nullptr); return script;