Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Prevent localize from throwing exceptions #876
Browse files Browse the repository at this point in the history
(cherry picked from commit 3b45822)
  • Loading branch information
heifner committed Jan 4, 2018
1 parent a6c5e20 commit b9f32ab
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions programs/eosioc/localize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}}}
}}}

0 comments on commit b9f32ab

Please sign in to comment.