Fix NULL ptr use from dlerror()

This commit is contained in:
2025-01-08 15:08:51 -04:00
parent 01ddb6d842
commit 4f2fbaa255
+6 -4
View File
@@ -65,11 +65,13 @@ SenseApiLib& SenseApiManager::loadSenseApiLib(const std::string& libraryPath)
if (!lib->handle) if (!lib->handle)
{ {
std::string error = dlerror() const char *dlerr = dlerror();
? dlerror()
: "Unknown error while opening shlib"; std::string error = (dlerr
? dlerr
: "Unknown error while opening shlib");
throw std::runtime_error( throw std::runtime_error(
std::string(__func__) + " - Cannot load library '" std::string(__func__) + ": Cannot load library '"
+ libraryPath + "': " + libraryPath + "': "
+ error); + error);
} }