Permalink
Browse files

Fix one more case of dlerror(), if it returns NULL after error.

  • Loading branch information...
1 parent 7312a36 commit 0491e55926591b043b8fa5b8f9b16a4c336018a6 @DarthGandalf DarthGandalf committed Jan 26, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/Modules.cpp
View
@@ -1169,7 +1169,9 @@ ModHandle CModules::OpenModule(const CString& sModule, const CString& sModPath,
if (!p) {
// dlerror() returns pointer to static buffer, which may be overwritten very soon with another dl call
- CString sDlError = dlerror();
+ // also it may just return null.
+ const char* cDlError = dlerror();
+ CString sDlError = cDlError ? cDlError : "Unknown error";
sRetMsg = "Unable to open module [" + sModule + "] [" + sDlError + "]";
return NULL;
}

0 comments on commit 0491e55

Please sign in to comment.