summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-05-30 05:03:54 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-05-30 05:03:54 +0000
commit01f51424edc1ff2ad7bf5b327548fcc5d1444a29 (patch)
tree5c53082954173aefa8e660925c8d6b26d0776dec
parent6a14f41c8686a8e31406b4d2c00ec708b45b6762 (diff)
downloadcrawl-ref-01f51424edc1ff2ad7bf5b327548fcc5d1444a29.tar.gz
crawl-ref-01f51424edc1ff2ad7bf5b327548fcc5d1444a29.zip
Fix crash when a monster without ammo considers dropping its launcher to pick
up one on the floor. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9848 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/mon-util.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 3e2b319020..5bc02bd5f3 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -4547,6 +4547,11 @@ bool monsters::drop_item(int eslot, int near)
static bool _compatible_launcher_ammo_brands(item_def *launcher,
const item_def *ammo)
{
+ // If the monster has no ammo then there's no compatibility problems
+ // to check.
+ if (ammo == NULL)
+ return (true);
+
const int bow_brand = get_weapon_brand(*launcher);
const int ammo_brand = get_ammo_brand(*ammo);