diff options
author | Adam Borowski <kilobyte@angband.pl> | 2011-09-03 12:56:26 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2011-09-03 20:05:24 +0200 |
commit | 90e1f5819811ce32738c90cd1094fa58f978dc20 (patch) | |
tree | 6f054c9df08f09c2464115aa7b88bdc531e5f607 /crawl-ref/source/l_item.cc | |
parent | 74ba56894442eb92ac2c5f9b2ea14f4764ceaa5f (diff) | |
download | crawl-ref-90e1f5819811ce32738c90cd1094fa58f978dc20.tar.gz crawl-ref-90e1f5819811ce32738c90cd1094fa58f978dc20.zip |
Unrevert and fix index_to_letter() checks, make them stricter.
The only place that can legitimately have a non-letter is the lua function,
and it'll now return -1 in that case. Most of the others had isaalpha()
already.
It's possible I missed some case and the asserts will now crash, but if so,
they'd re buggy anyway (accepting digits and interpunction as slots).
Diffstat (limited to 'crawl-ref/source/l_item.cc')
-rw-r--r-- | crawl-ref/source/l_item.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crawl-ref/source/l_item.cc b/crawl-ref/source/l_item.cc index 288b1fe751..6de44c2ed5 100644 --- a/crawl-ref/source/l_item.cc +++ b/crawl-ref/source/l_item.cc @@ -796,7 +796,7 @@ static int l_item_letter_to_index(lua_State *ls) const char *s = luaL_checkstring(ls, 1); if (!s || !*s || s[1]) return (0); - lua_pushnumber(ls, letter_to_index(*s)); + lua_pushnumber(ls, isaalpha(*s) ? letter_to_index(*s) : -1); return (1); } |