From 180e3f5cd1c85a61b8a9dfd96e7144701ed5db5f Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 25 Mar 2008 23:47:42 +0000 Subject: [PATCH] prevent crash on no dlerror --- dtool/src/dtoolutil/load_dso.cxx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/dtool/src/dtoolutil/load_dso.cxx b/dtool/src/dtoolutil/load_dso.cxx index f41d970b39..d2b92534c6 100644 --- a/dtool/src/dtoolutil/load_dso.cxx +++ b/dtool/src/dtoolutil/load_dso.cxx @@ -116,8 +116,11 @@ void * load_dso(const DSearchPath &path, const Filename &filename) string load_dso_error() { - return std::string(dlerror()); - //return "No DSO loading yet!"; + char *message = dlerror(); + if (message != (char *)NULL) { + return std::string(message); + } + return "No error."; } #else @@ -142,7 +145,11 @@ unload_dso(void *dso_handle) { string load_dso_error() { - return dlerror(); + char *message = dlerror(); + if (message != (char *)NULL) { + return std::string(message); + } + return "No error."; } #endif