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-Tag: 0.4.10~154 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8d315347100f1d261bb496b6c73f8cab5d2b7a41;p=oweals%2Fminetest.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 750755649..343b548e9 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);