Revision: 76915
          http://sourceforge.net/p/brlcad/code/76915
Author:   starseeker
Date:     2020-08-24 13:17:57 +0000 (Mon, 24 Aug 2020)
Log Message:
-----------
Check dm_get_pathname result in to_is_viewable

Modified Paths:
--------------
    brlcad/trunk/src/libtclcad/view/util.c

Modified: brlcad/trunk/src/libtclcad/view/util.c
===================================================================
--- brlcad/trunk/src/libtclcad/view/util.c      2020-08-24 13:17:35 UTC (rev 
76914)
+++ brlcad/trunk/src/libtclcad/view/util.c      2020-08-24 13:17:57 UTC (rev 
76915)
@@ -58,23 +58,23 @@
 int
 to_is_viewable(struct bview *gdvp)
 {
-    Tcl_Obj *our_result;
-    Tcl_Obj *saved_result;
     int result_int;
-    const char *pathname;
+
     const struct bu_vls *pathvls = dm_get_pathname((struct dm *)gdvp->dmp);
+    if (!pathvls || !bu_vls_strlen(pathvls)) {
+       return 0;
+    }
 
-    pathname = bu_vls_addr(pathvls);
-
     /* stash any existing result so we can inspect our own */
-    saved_result = Tcl_GetObjResult(current_top->to_interp);
+    Tcl_Obj *saved_result = Tcl_GetObjResult(current_top->to_interp);
     Tcl_IncrRefCount(saved_result);
 
+    const char *pathname = bu_vls_cstr(pathvls);
     if (pathname && tclcad_eval(current_top->to_interp, "winfo viewable", 1, 
&pathname) != TCL_OK) {
        return 0;
     }
 
-    our_result = Tcl_GetObjResult(current_top->to_interp);
+    Tcl_Obj *our_result = Tcl_GetObjResult(current_top->to_interp);
     Tcl_GetIntFromObj(current_top->to_interp, our_result, &result_int);
 
     /* restore previous result */

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to