]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-gui: avoid an error message when removing the last remote
authorPat Thoyts <patthoyts@users.sourceforge.net>
Sat, 15 Jun 2013 22:36:27 +0000 (23:36 +0100)
committerPat Thoyts <patthoyts@users.sourceforge.net>
Sat, 15 Jun 2013 22:36:27 +0000 (23:36 +0100)
When the last remote is removed on a system that has tearoff menu items
the code that adjusts the fetch and prune menus may raise an error when
probing the menu entry for a non-existing -label option.
Check the entry type to avoid this fault.

Reported-by: Vedran Miletić <rivanvx@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
lib/remote.tcl

index 5e4e7f4c83952ac2ec4c60eb79426248071ae54e..4e5c7844188ee2eab0c9f6e00835b99c69bbdfc2 100644 (file)
@@ -245,7 +245,8 @@ proc update_all_remotes_menu_entry {} {
        set prune_m $remote_m.prune
        if {$have_remote > 1} {
                make_sure_remote_submenues_exist $remote_m
-               if {[$fetch_m entrycget end -label] ne "All"} {
+               if {[$fetch_m type end] eq "command" \
+                       && [$fetch_m entrycget end -label] ne "All"} {
 
                        $fetch_m insert end separator
                        $fetch_m insert end command \
@@ -259,7 +260,8 @@ proc update_all_remotes_menu_entry {} {
                }
        } else {
                if {[winfo exists $fetch_m]} {
-                       if {[$fetch_m entrycget end -label] eq "All"} {
+                       if {[$fetch_m type end] eq "command" \
+                               && [$fetch_m entrycget end -label] eq "All"} {
 
                                delete_from_menu $fetch_m end
                                delete_from_menu $fetch_m end