diff --git a/Core/Libraries/Source/WWVegas/WWLib/refcount.h b/Core/Libraries/Source/WWVegas/WWLib/refcount.h index d1522853043..3dcf248e0d9 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/refcount.h +++ b/Core/Libraries/Source/WWVegas/WWLib/refcount.h @@ -60,7 +60,7 @@ struct ActiveRefStruct ** you want to point it at some object. You must release whatever it currently points at, ** point it at the new object, and add-ref the new object (if its not null...) */ -#define REF_PTR_SET(dst,src) { if (src) (src)->Add_Ref(); if (dst) (dst)->Release_Ref(); (dst) = (src); } +#define REF_PTR_SET(dst,src) { if ((dst) != (src)) { if (src) (src)->Add_Ref(); if (dst) (dst)->Release_Ref(); (dst) = (src); } } #define REF_PTR_RELEASE(x) { if (x) x->Release_Ref(); x = nullptr; } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 38595af3fcf..cd7d688e8db 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -2671,7 +2671,11 @@ void W3DDisplay::drawImage( const Image *image, Int startX, Int startY, TextureClass *tex = nullptr; if (BitIsSet(image->getStatus(), IMAGE_STATUS_RAW_TEXTURE)) + { tex = (TextureClass *)(image->getRawTextureData()); + if (!tex) + return; // raw texture data is null; nothing to render + } else tex = WW3DAssetManager::Get_Instance()->Get_Texture(image->getFilename().str(), MIP_LEVELS_1); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index c59213d5df9..355a5ebc18b 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -2760,7 +2760,11 @@ void W3DDisplay::drawImage( const Image *image, Int startX, Int startY, TextureClass *tex = nullptr; if (BitIsSet(image->getStatus(), IMAGE_STATUS_RAW_TEXTURE)) + { tex = (TextureClass *)(image->getRawTextureData()); + if (!tex) + return; // raw texture data is null; nothing to render + } else tex = WW3DAssetManager::Get_Instance()->Get_Texture(image->getFilename().str(), MIP_LEVELS_1);