summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-wpnench.cc
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2014-06-12 14:05:34 -0400
committerNeil Moore <neil@s-z.org>2014-06-12 14:06:20 -0400
commit62da3a1b50ace201ebcccd202515e3685b5e3234 (patch)
tree84de9535e9db7a32c29ec450f059fce02bebb07b /crawl-ref/source/spl-wpnench.cc
parente561a6638b9c70b2f3ad265faa83520c7af28226 (diff)
downloadcrawl-ref-62da3a1b50ace201ebcccd202515e3685b5e3234.tar.gz
crawl-ref-62da3a1b50ace201ebcccd202515e3685b5e3234.zip
Don't crash when unwielding a temp-branded weapon.
Diffstat (limited to 'crawl-ref/source/spl-wpnench.cc')
-rw-r--r--crawl-ref/source/spl-wpnench.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/crawl-ref/source/spl-wpnench.cc b/crawl-ref/source/spl-wpnench.cc
index b6a6192873..8cf2a7df89 100644
--- a/crawl-ref/source/spl-wpnench.cc
+++ b/crawl-ref/source/spl-wpnench.cc
@@ -56,14 +56,13 @@ static bool _ok_for_launchers(brand_type which_brand)
*
* Returns the weapon to the previous brand, and ends the
* DUR_WEAPON_BRAND.
+ * @param weapon The item in question (which may have just been unwielded).
* @param verbose whether to print a message about expiration.
*/
-void end_weapon_brand(bool verbose)
+void end_weapon_brand(item_def &weapon, bool verbose)
{
ASSERT(you.duration[DUR_WEAPON_BRAND]);
- ASSERT(you.weapon());
- item_def& weapon = *you.weapon();
const int temp_effect = get_weapon_brand(weapon);
set_item_ego_type(weapon, OBJ_WEAPONS, you.props["orig brand"]);
you.wield_change = true;
@@ -254,7 +253,7 @@ spret_type brand_weapon(brand_type which_brand, int power, bool fail)
if (!extending)
{
if (has_temp_brand)
- end_weapon_brand();
+ end_weapon_brand(weapon);
you.props["orig brand"] = get_weapon_brand(weapon);
set_item_ego_type(weapon, OBJ_WEAPONS, which_brand);
you.wield_change = true;