From: Perttu Ahola Date: Sun, 27 Apr 2014 06:49:00 +0000 (+0300) Subject: Client: Don't crash if trying to draw too many items from inventory in HUD X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=8d315347100f1d261bb496b6c73f8cab5d2b7a41;p=zefram%2Fminetest%2Fminetest_engine.git Client: Don't crash if trying to draw too many items from inventory in HUD --- 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);