git-gui: Don't crash when starting gitk from a browser session
authorShawn O. Pearce <spearce@spearce.org>
Tue, 2 Oct 2007 16:27:32 +0000 (12:27 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Wed, 3 Oct 2007 04:16:04 +0000 (00:16 -0400)
If the user has started git-gui from the command line as a browser
we offer the gitk menu options but we didn't create the main status
bar widget in the "." toplevel.  Trying to access it while starting
gitk just results in Tcl errors.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui.sh

index 9682418e1225499caf99151e8a91968cdb106c2c..cf88a0d8247e8578e5740d290ee1e72b011f2fe2 100755 (executable)
@@ -1125,11 +1125,17 @@ proc mapdesc {state path} {
 }
 
 proc ui_status {msg} {
-       $::main_status show $msg
+       global main_status
+       if {[info exists main_status]} {
+               $main_status show $msg
+       }
 }
 
 proc ui_ready {{test {}}} {
-       $::main_status show {Ready.} $test
+       global main_status
+       if {[info exists main_status]} {
+               $main_status show [mc "Ready."] $test
+       }
 }
 
 proc escape_path {path} {