check for null-ptr from cxa_demangle

This commit is contained in:
Joachim Schoeberl 2023-04-28 17:33:07 +02:00
parent fe3abbdec4
commit 8a79f91cb1

View File

@ -64,8 +64,14 @@ namespace ngcore
try
{
char *s = abi::__cxa_demangle(typeinfo, nullptr, nullptr, &status);
std::string result{s};
free(s);
std::string result;
if (s == nullptr)
result = typeinfo;
else
{
result = s;
free(s);
}
result = detail::CleanupDemangledName(result);
return result;
}