diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh index 5bc21b878d413e..3ce2e04bc58ee2 100755 --- a/git-gui/git-gui.sh +++ b/git-gui/git-gui.sh @@ -2505,6 +2505,10 @@ proc toggle_or_diff {mode w args} { if {$last_clicked ne {}} { set lno [lindex $last_clicked 1] } else { + if {[llength $file_lists($w)] == 0} { + set last_clicked {} + return + } set lno [expr {int([lindex [$w tag ranges in_diff] 0])}] } if {$mode eq "toggle"} {