Client: Don't crash if trying to draw too many items from inventory in HUD
authorPerttu Ahola <celeron55@gmail.com>
Sun, 27 Apr 2014 06:49:00 +0000 (09:49 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Sun, 27 Apr 2014 06:49:19 +0000 (09:49 +0300)
src/hud.cpp

index 750755649c29cc580fb59870ae93a5b02d42d69d..343b548e9fdf1b91b24048557357431229482003 100644 (file)
@@ -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);