From e3945da045a33afc3cc69209e995714d58d51757 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sat, 9 Apr 2022 00:38:11 +0100 Subject: [PATCH] Fix a negative shift exponent sanitizer warning Source/spells.h:54:14: runtime error: shift exponent -1 is negative --- Source/panels/spell_list.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/panels/spell_list.cpp b/Source/panels/spell_list.cpp index 817989b4d..ae329461e 100644 --- a/Source/panels/spell_list.cpp +++ b/Source/panels/spell_list.cpp @@ -321,8 +321,9 @@ void ToggleSpell(int slot) return; } - if ((spells & GetSpellBitmask(myPlayer._pSplHotKey[slot])) != 0) { - myPlayer._pRSpell = myPlayer._pSplHotKey[slot]; + const spell_id spellId = myPlayer._pSplHotKey[slot]; + if (spellId != SPL_INVALID && spellId != SPL_NULL && (spells & GetSpellBitmask(spellId)) != 0) { + myPlayer._pRSpell = spellId; myPlayer._pRSplType = myPlayer._pSplTHotKey[slot]; force_redraw = 255; }