handle theoretical future failures of wsview_to_char

This commit is contained in:
mjk 2021-03-19 22:47:47 +00:00 committed by LAGonauta
parent ab6ce05aec
commit 15abe70fc6

View file

@ -20,6 +20,8 @@ namespace glib::impl
if (not wmsg.empty()) if (not wmsg.empty())
{ {
ptr = wsview_to_char(wmsg); ptr = wsview_to_char(wmsg);
if (not ptr)
throw 42;
std::string msg{ptr}; std::string msg{ptr};
g_free(const_cast<char *>(ptr)); // WTF? Deletion is not modification! g_free(const_cast<char *>(ptr)); // WTF? Deletion is not modification!
return {{ e.code(), {std::move(msg)} }}; return {{ e.code(), {std::move(msg)} }};