From 1db80744628cd12b777340850d702e7ff8fbc6fd Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Fri, 15 May 2026 19:51:18 +0200 Subject: [PATCH] fix(object): Avoid crash if Object drawable is nullptr on save game load. --- Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp | 6 ++---- .../Code/GameEngine/Source/GameLogic/Object/Object.cpp | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp index edda6839d12..85bd61efa71 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -3608,12 +3608,10 @@ void Object::xfer( Xfer *xfer ) Drawable *draw = getDrawable(); DrawableID drawableID = draw ? draw->getID() : INVALID_DRAWABLE_ID; xfer->xferDrawableID( &drawableID ); - if( xfer->getXferMode() == XFER_LOAD ) + if (draw && xfer->getXferMode() == XFER_LOAD) { - // change the ID of the drawable attached to be the same ID as it was when it was saved - draw->setID( drawableID ); - + draw->setID(drawableID); } // internal name diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 0a03557b1b3..a8029b4ec8d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -4118,12 +4118,10 @@ void Object::xfer( Xfer *xfer ) Drawable *draw = getDrawable(); DrawableID drawableID = draw ? draw->getID() : INVALID_DRAWABLE_ID; xfer->xferDrawableID( &drawableID ); - if( xfer->getXferMode() == XFER_LOAD ) + if (draw && xfer->getXferMode() == XFER_LOAD) { - // change the ID of the drawable attached to be the same ID as it was when it was saved - draw->setID( drawableID ); - + draw->setID(drawableID); } // internal name