From a78b2e54a4e3756ea0ef13061900ca3829e0b12c Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Fri, 19 Nov 2021 14:09:16 +0100 Subject: [PATCH] Fixes potential overflow in script suppression. --- src/Battling/ScriptHandling/BattleScript.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Battling/ScriptHandling/BattleScript.hpp b/src/Battling/ScriptHandling/BattleScript.hpp index 047030a..ec785d0 100644 --- a/src/Battling/ScriptHandling/BattleScript.hpp +++ b/src/Battling/ScriptHandling/BattleScript.hpp @@ -26,7 +26,10 @@ namespace CreatureLib::Battling { inline ArbUt::OptionalBorrowedPtr GetOwner() const noexcept { return _owner; } inline bool IsSuppressed() const noexcept { return _suppressed > 0; } inline void Suppress() { _suppressed++; } - inline void Unsuppress() { _suppressed--; } + inline void Unsuppress() { + if (_suppressed > 0) + _suppressed--; + } virtual ~BattleScript() = default;