render: perform proper null checks for item_get_name()

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I007a86584f618f990f7a5ed569115aeb6a6a6964
This commit is contained in:
raf 2026-04-08 14:28:50 +03:00 committed by raf
commit 6050083293

View file

@ -373,10 +373,12 @@ void render_inventory_overlay(const Player *p, int selected) {
// Item name
const char *name = item_get_name(item);
Color name_color = (item->type == ITEM_POTION) ? (Color){255, 140, 140, 255}
: (item->type == ITEM_WEAPON) ? (Color){255, 255, 140, 255}
: (Color){140, 140, 255, 255};
DrawText(name, overlay.x + 45, y_pos + 4, 14, name_color);
if (name) {
Color name_color = (item->type == ITEM_POTION) ? (Color){255, 140, 140, 255}
: (item->type == ITEM_WEAPON) ? (Color){255, 255, 140, 255}
: (Color){140, 140, 255, 255};
DrawText(name, overlay.x + 45, y_pos + 4, 14, name_color);
}
// Power
snprintf(slot_text, sizeof(slot_text), "+%d", item->power);