Skip to content

Commit 5c37033

Browse files
committed
git-gui: avoid an error message when removing the last remote
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ć <[email protected]> Signed-off-by: Pat Thoyts <[email protected]>
1 parent 2f38dd0 commit 5c37033

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/remote.tcl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ proc update_all_remotes_menu_entry {} {
245245
set prune_m $remote_m.prune
246246
if {$have_remote > 1} {
247247
make_sure_remote_submenues_exist $remote_m
248-
if {[$fetch_m entrycget end -label] ne "All"} {
248+
if {[$fetch_m type end] eq "command" \
249+
&& [$fetch_m entrycget end -label] ne "All"} {
249250

250251
$fetch_m insert end separator
251252
$fetch_m insert end command \
@@ -259,7 +260,8 @@ proc update_all_remotes_menu_entry {} {
259260
}
260261
} else {
261262
if {[winfo exists $fetch_m]} {
262-
if {[$fetch_m entrycget end -label] eq "All"} {
263+
if {[$fetch_m type end] eq "command" \
264+
&& [$fetch_m entrycget end -label] eq "All"} {
263265

264266
delete_from_menu $fetch_m end
265267
delete_from_menu $fetch_m end

0 commit comments

Comments
 (0)