Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5284,7 +5284,13 @@ Object * ScriptEngine::getUnitNamed(const AsciiString& unitName)

for (VecNamedRequestsIt it = m_namedObjects.begin(); it != m_namedObjects.end(); ++it) {
if (unitName == (it->first)) {
return it->second;
// Check if the object pointer is valid before returning it
// Objects can be deleted but remain in cache with NULL pointer
if (it->second != NULL) {
return it->second;
}
// Object was deleted, return NULL
return NULL;
}
}
return NULL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6033,7 +6033,13 @@ Object* ScriptEngine::getUnitNamed(const AsciiString& unitName)

for (VecNamedRequestsIt it = m_namedObjects.begin(); it != m_namedObjects.end(); ++it) {
if (unitName == (it->first)) {
return it->second;
// Check if the object pointer is valid before returning it
// Objects can be deleted but remain in cache with NULL pointer
if (it->second != NULL) {
return it->second;
}
// Object was deleted, return NULL
return NULL;
}
}
return NULL;
Expand Down
Loading