Skip to content

Commit 7ee1d59

Browse files
committed
Fixed segfault on reloading objects without a preset
1 parent 9c12bc1 commit 7ee1d59

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Source/Entities/MovableObject.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ int MovableObject::ReloadScripts() {
563563

564564
// TODO consider getting rid of this const_cast. It would require either code duplication or creating some non-const methods (specifically of PresetMan::GetEntityPreset, which may be unsafe. Could be this gross exceptional handling is the best way to go.
565565
MovableObject* movableObjectPreset = const_cast<MovableObject*>(dynamic_cast<const MovableObject*>(g_PresetMan.GetEntityPreset(GetClassName(), GetPresetName(), GetModuleID())));
566-
if (this != movableObjectPreset) {
566+
if (movableObjectPreset && this != movableObjectPreset) {
567567
movableObjectPreset->ReloadScripts();
568568
}
569569

0 commit comments

Comments
 (0)