|
From: <gi...@cr...> - 2026-01-27 12:00:14
|
via 2e857c154fd84d110ba0bf67d43edff063f8075d (commit)
from 7311b66b6d0ed5f94cb598b45e1adcb87a69a05b (commit)
-----------------------------------------------------------------------
commit 2e857c154fd84d110ba0bf67d43edff063f8075d
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
|