From 79cd94d26df33a332586b2aa72a99b123199c88f Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 30 Jun 2020 00:22:25 +0200 Subject: Core/Misc: Changed GetLocaleByName to return invalid value on invalid input instead of LOCALE_enUS * Also added IsValidLocale helper function --- src/common/Common.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/common/Common.h') diff --git a/src/common/Common.h b/src/common/Common.h index 732583da0de..f35773e7c70 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -101,6 +101,11 @@ TC_COMMON_API extern char const* localeNames[TOTAL_LOCALES]; TC_COMMON_API LocaleConstant GetLocaleByName(std::string const& name); +constexpr inline bool IsValidLocale(LocaleConstant locale) +{ + return locale < TOTAL_LOCALES&& locale != LOCALE_none; +} + #pragma pack(push, 1) struct LocalizedString -- cgit v1.2.3