From 317f7418112475228f7ba97cecf35731ecdeb110 Mon Sep 17 00:00:00 2001 From: Asdow Date: Tue, 16 Aug 2022 13:37:08 +0000 Subject: [PATCH] Added assertion with error message to prevent silent crashes/nullptr dereference if loading big item graphics fails. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9396 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Laptop/BobbyRGuns.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Laptop/BobbyRGuns.cpp b/Laptop/BobbyRGuns.cpp index 154e419d..823f35ce 100644 --- a/Laptop/BobbyRGuns.cpp +++ b/Laptop/BobbyRGuns.cpp @@ -1930,6 +1930,7 @@ BOOLEAN DisplayBigItemImage(UINT16 usIndex, UINT16 PosY) LoadTileGraphicForItem(pItem, &uiImage); GetVideoObject(&hPixHandle, uiImage); + if (hPixHandle == nullptr) { SET_ERROR("Error: Could not load item uiIndex %d graphics. ubGraphicType %d and ubGraphicNum %d", usIndex, pItem->ubGraphicType, pItem->ubGraphicNum); AssertMsg(false, gubErrorText); } if(hPixHandle->ubBitDepth == 8) {