Fix crash on macOS when unlocking database

* Fix #8639
This commit is contained in:
Jonathan White 2022-10-26 23:51:49 -04:00
parent 422fd91255
commit 2583cc4aa4

View File

@ -31,7 +31,11 @@ inline std::string StatusToErrorMessage(OSStatus status)
return std::to_string(status);
}
std::string result(CFStringGetCStringPtr(text, kCFStringEncodingUTF8));
auto msg = CFStringGetCStringPtr(text, kCFStringEncodingUTF8);
std::string result;
if (msg) {
result = msg;
}
CFRelease(text);
return result;
}