Fix config file parameter introspection bug 68/4168/1
authorJim Phillips <jim@ks.uiuc.edu>
Fri, 11 May 2018 20:43:28 +0000 (15:43 -0500)
committerJim Phillips <jim@ks.uiuc.edu>
Fri, 11 May 2018 20:43:28 +0000 (15:43 -0500)
Previous changes to drop Tcl USE_COMPAT_CONST introduced a bug
when trying to read the value of a previously set parameter
before startup.  Fix, and error message improved.

Change-Id: I655bd994cca49b8d680854473dc7b10d7e97f06c

src/ScriptTcl.C

index bcc7da9..662640d 100644 (file)
@@ -813,11 +813,12 @@ int ScriptTcl::Tcl_config(ClientData clientData,
     return TCL_OK;
   }
   delete [] data;
-  delete [] name;
 
   StringList *strlist = script->config->find(name);
+  delete [] name;
+
   if ( ! strlist ) {
-    Tcl_SetResult(interp,"error parsing config file",TCL_VOLATILE);
+    Tcl_SetResult(interp,"tried before startup to read config file parameter that was not set",TCL_VOLATILE);
     return TCL_ERROR;
   }
   Tcl_SetResult(interp,strlist->data,TCL_VOLATILE);