From 43fa9090c145986ea58dc6f1e5c3666d5910ab89 Mon Sep 17 00:00:00 2001 From: Flugente Date: Sun, 22 Jan 2017 20:37:13 +0000 Subject: [PATCH] Fix: crash when displaying LBE with corrupted content. This des not fix whatever corrupts the LBE, it merely stops the game from crashing. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8373 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Interface Items.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index df81050e..9c543c74 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -8149,9 +8149,17 @@ void RenderLBENODEItems( OBJECTTYPE *pObj, int subObject ) } else if(activeNode == true) { + // Flugente: if LBE inv des not exist (corrupted memory?), don't try to access it. This doesn't solve the issue of HOW it got corrupted, but at least we don't crash the game anymore... + if ( pLBE->inv.size() <= cnt ) + { + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Error in RenderLBENODEItems(...): contents of %s likely corrupted!", Item[pObj->usItem].szItemName ); + continue; + } + if(pLBE->inv[cnt].exists() == true) pObject = &pLBE->inv[cnt]; } + if(lbePocket == 0){ // Deactivate Pocket DrawHatchOnInventory( guiSAVEBUFFER, sX, sY, (UINT16)(LBEInvPocketXY[cnt].sWidth-1), (UINT16)(LBEInvPocketXY[cnt].sHeight-1), 0 ); }