From e7975ff335f51d429c79b128209d33f7808f3782 Mon Sep 17 00:00:00 2001
From: andreask <andreask>
Date: Mon, 27 Aug 2012 17:12:06 +0000
Subject: Followup to [6325d5dbeac6f91d28d6]. dlerror() may return NULL. Fixed
 the code which wasn't prepared to deal with that.

---
 unix/tclLoadDl.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c
index f8fe6d3..a48aa23 100644
--- a/unix/tclLoadDl.c
+++ b/unix/tclLoadDl.c
@@ -176,8 +176,14 @@ FindSymbol(
     }
     Tcl_DStringFree(&ds);
     if (proc == NULL && interp != NULL) {
+	const char *errorStr = dlerror();
+
+	if (!errorStr) {
+	    errorStr = "unknown";
+	}
+
 	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
-		"cannot find symbol \"%s\": %s", symbol, dlerror()));
+		"cannot find symbol \"%s\": %s", symbol, errorStr));
 	Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "LOAD_SYMBOL", symbol,
 		NULL);
     }
-- 
cgit v0.12

