diff options
author | Adam Borowski <kilobyte@angband.pl> | 2012-06-28 22:35:42 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2012-06-28 22:35:42 +0200 |
commit | f7678ec15ddec20d6bfe63f10beecb7c417f3553 (patch) | |
tree | 32b04d1438e279e30b4c68af88b9335886e3d63d /crawl-ref/source/l_food.cc | |
parent | 0535df25186bbdd7f56777a74c36acc9b9b1a738 (diff) | |
download | crawl-ref-f7678ec15ddec20d6bfe63f10beecb7c417f3553.tar.gz crawl-ref-f7678ec15ddec20d6bfe63f10beecb7c417f3553.zip |
Fix a crash on demand on lua food.eat(potion)
Diffstat (limited to 'crawl-ref/source/l_food.cc')
-rw-r--r-- | crawl-ref/source/l_food.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crawl-ref/source/l_food.cc b/crawl-ref/source/l_food.cc index f5837defae..7dc0e7ed6e 100644 --- a/crawl-ref/source/l_food.cc +++ b/crawl-ref/source/l_food.cc @@ -77,6 +77,12 @@ static int food_can_eat(lua_State *ls) static bool eat_item(const item_def &item) { + // Nasty special case: can_ingest() allows potions (why???), so we need + // to weed them away here; we wouldn't be able to return success status + // otherwise. + if (!can_ingest(item, false) || item.base_type == OBJ_POTIONS) + return false; + if (in_inventory(item)) { eat_inventory_item(item.link); |