handle empty hresult_error message specially
This commit is contained in:
parent
c44b1daaf7
commit
ab6ce05aec
|
@ -16,10 +16,16 @@ namespace glib::impl
|
||||||
const char *ptr = nullptr;
|
const char *ptr = nullptr;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ptr = wsview_to_char(e.message());
|
const auto wmsg = std::wstring_view{e.message()};
|
||||||
std::string msg{ptr};
|
if (not wmsg.empty())
|
||||||
g_free(const_cast<char *>(ptr)); // WTF? Deletion is not modification!
|
{
|
||||||
return {{ e.code(), {std::move(msg)} }};
|
ptr = wsview_to_char(wmsg);
|
||||||
|
std::string msg{ptr};
|
||||||
|
g_free(const_cast<char *>(ptr)); // WTF? Deletion is not modification!
|
||||||
|
return {{ e.code(), {std::move(msg)} }};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return {{ e.code(), {"<no error description>"} }};
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue