From b9f32ab7aae5f524c4060760e2a8f388fb2d45fe Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Wed, 6 Dec 2017 18:39:25 -0600 Subject: [PATCH] Prevent localize from throwing exceptions #876 (cherry picked from commit 3b45822ed045ee2242fe6e79bf847563007f2157) --- programs/eosioc/localize.hpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/programs/eosioc/localize.hpp b/programs/eosioc/localize.hpp index ee730680456..72cd073e813 100644 --- a/programs/eosioc/localize.hpp +++ b/programs/eosioc/localize.hpp @@ -15,6 +15,13 @@ namespace eosio { namespace client { namespace localize { #define localized(str, ...) localized_with_variant((str), fc::mutable_variant_object() __VA_ARGS__ ) inline auto localized_with_variant( const char* raw_fmt, const fc::variant_object& args) { - return fc::format_string(::gettext(raw_fmt), args); + if (raw_fmt != nullptr) { + try { + return fc::format_string(::gettext(raw_fmt), args); + } catch (...) { + } + return std::string(raw_fmt); + } + return std::string(); } -}}} \ No newline at end of file +}}}