From 8d315347100f1d261bb496b6c73f8cab5d2b7a41 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 27 Apr 2014 09:49:00 +0300 Subject: [PATCH] Client: Don't crash if trying to draw too many items from inventory in HUD --- src/hud.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hud.cpp b/src/hud.cpp index 75075564..343b548e 100644 --- a/src/hud.cpp +++ b/src/hud.cpp @@ -127,7 +127,7 @@ void Hud::drawItem(v2s32 upperleftpos, s32 imgsize, s32 itemcount, NULL, hbar_colors, true); } - for (s32 i = 0; i < itemcount; i++) + for (s32 i = 0; i < itemcount && (size_t)i < mainlist->getSize(); i++) { const ItemStack &item = mainlist->getItem(i); -- 2.30.2