mirror of
https://github.com/vcmi/vcmi.git
synced 2025-05-13 22:06:58 +02:00
Add sanity check
This commit is contained in:
parent
b6a1a8f0da
commit
609f25f344
@ -234,6 +234,12 @@ si32 PlayerColor::decode(const std::string & identifier)
|
|||||||
|
|
||||||
std::string PlayerColor::encode(const si32 index)
|
std::string PlayerColor::encode(const si32 index)
|
||||||
{
|
{
|
||||||
|
if (index < 0 || index >= std::size(GameConstants::PLAYER_COLOR_NAMES))
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
return "invalid";
|
||||||
|
}
|
||||||
|
|
||||||
return GameConstants::PLAYER_COLOR_NAMES[index];
|
return GameConstants::PLAYER_COLOR_NAMES[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user