From 310b2a4dc3c5698da8f7cb7e169e223b3e6a4389 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Fri, 29 Nov 2019 01:17:19 +0100 Subject: [PATCH] Fix OOB in Theme_Library Fixes #487 --- Source/themes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/themes.cpp b/Source/themes.cpp index e5598b305..e1922d124 100644 --- a/Source/themes.cpp +++ b/Source/themes.cpp @@ -723,7 +723,7 @@ void Theme_Library(int t) for (xp = 1; xp < MAXDUNX - 1; xp++) { if (CheckThemeObj3(xp, yp, t, -1) && dMonster[xp][yp] == 0 && random_(0, librnd[leveltype - 1]) == 0) { AddObject(OBJ_BOOKSTAND, xp, yp); - if (random_(0, 2 * librnd[leveltype - 1]) != 0) { /// BUGFIX: check dObject[xp][yp] was populated by AddObject + if (random_(0, 2 * librnd[leveltype - 1]) != 0 && dObject[xp][yp]) { /// BUGFIX: check dObject[xp][yp] was populated by AddObject (fixed) oi = dObject[xp][yp] - 1; object[oi]._oSelFlag = 0; object[oi]._oAnimFrame += 2;