Skip to content

Commit

Permalink
Fix build (PR #3098)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pirulax committed Jul 3, 2023
1 parent 55647f4 commit 9dcc651
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Shared/mods/deathmatch/logic/lua/CLuaFunctionParser.h
Expand Up @@ -379,11 +379,12 @@ struct CLuaFunctionParserBase

// NOTE/TODO: Use C++20 `std::in_range` here instead
// For now this doesn't do all the safety checks, but this should be "good enough" [until we switch to C++20]
if constexpr (std::is_integral_v<T> && std::is_unsigned_v<T> && number < 0)
if constexpr (std::is_integral_v<T> && std::is_unsigned_v<T>)
{
SetError("positive number", "negative");

return static_cast<T>(static_cast<int64_t>(number));
if (number < 0) {
SetError("positive number", "negative");
return static_cast<T>(number);
}
}

return static_cast<T>(number);
Expand Down

0 comments on commit 9dcc651

Please sign in to comment.