Skip to content

Commit 8f4c9cf

Browse files
authored
Merge pull request #8 from dktapps/dlopen-errors
Log errors if dlopen() returned null
2 parents a788e47 + 262f702 commit 8f4c9cf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/loader.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ void *ModLoaderImpl::loadLib(std::string const &path) {
9090
}
9191

9292
void* ret = dlopen(fullPath.c_str(), RTLD_LAZY);
93+
if (!ret) {
94+
Log::error("ModLoader", "Failed loading library %s: %s", fullPath.c_str(), dlerror());
95+
return nullptr;
96+
}
9397
std::string filename = iof != std::string::npos ? path.substr(iof + 1) : path;
9498
knownLoadedLibs[filename] = ret;
9599
return ret;

0 commit comments

Comments
 (0)