|
From: <gi...@cr...> - 2026-01-27 11:55:15
|
via 231e7417e9e9573ad8c62913d576df266f97f607 (commit)
from ff61f77f9cb9bc203635fe8d9b8c73c4b5e0c7c3 (commit)
-----------------------------------------------------------------------
commit 231e7417e9e9573ad8c62913d576df266f97f607
Author: Isaac Clancy <ik...@ya...>
Date: Wed Jan 28 00:35:23 2026 +1300
Fix a crash when trying to get the slot for an item in lua
If given an item that is assigned to an invalid letter, the lua item
slot property would crash the game. Instead, it should return nil.
-----------------------------------------------------------------------
Summary of changes:
crawl-ref/source/l-item.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/crawl-ref/source/l-item.cc b/crawl-ref/source/l-item.cc
index 55af9ec9ab..f6171d20fc 100644
--- a/crawl-ref/source/l-item.cc
+++ b/crawl-ref/source/l-item.cc
@@ -510,7 +510,7 @@ IDEF(quantity)
*/
IDEF(slot)
{
- if (item && in_inventory(*item))
+ if (item && in_inventory(*item) && isalpha(item->slot))
lua_pushinteger(ls, letter_to_index(item->slot));
else
lua_pushnil(ls);
--
Dungeon Crawl Stone Soup
|