From 07f275a3810dde9385c924df6e1ba4841ddfd9cc Mon Sep 17 00:00:00 2001 From: RickyRister Date: Sun, 26 Jul 2026 15:15:34 -0700 Subject: [PATCH] fix guard --- cockatrice/src/game_graphics/tally/tally.cpp | 3 +-- cockatrice/src/game_graphics/tally/tally.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cockatrice/src/game_graphics/tally/tally.cpp b/cockatrice/src/game_graphics/tally/tally.cpp index 9e08114c8..f9389d0d6 100644 --- a/cockatrice/src/game_graphics/tally/tally.cpp +++ b/cockatrice/src/game_graphics/tally/tally.cpp @@ -4,8 +4,7 @@ TallyType Tally::intToType(int value) { - // remember to change this whenever you add a new member - if (value < static_cast(TallyType::None) || value >= static_cast(TallyType::Subtypes)) { + if (value < static_cast(TallyType::None) || value > static_cast(TallyType::MaxValue)) { return TallyType::None; } diff --git a/cockatrice/src/game_graphics/tally/tally.h b/cockatrice/src/game_graphics/tally/tally.h index d3665f442..d0fd77127 100644 --- a/cockatrice/src/game_graphics/tally/tally.h +++ b/cockatrice/src/game_graphics/tally/tally.h @@ -20,6 +20,7 @@ enum class TallyType { None, Subtypes, + MaxValue = Subtypes // sentinel value }; namespace Tally