Skip to content

Commit

Permalink
gitk: Fix bug causing Tcl error when no commits are selected
Browse files Browse the repository at this point in the history
Some of the stuff that commit 31c0eaa
added to drawvisible isn't appropriate to do when we have no commits,
and this was causing a Tcl error if gitk was invoked in such a fashion
that no commits were selected.  This fixes it by bailing out of
drawvisible early if there are no commits displayed.

Bug reported by Johannes Sixt.

Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Paul Mackerras committed Jan 15, 2008
1 parent e7297a1 commit 5a7f577
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gitk
Original file line number Diff line number Diff line change
Expand Up @@ -4573,7 +4573,7 @@ proc drawvisible {} {

set fs [$canv yview]
set ymax [lindex [$canv cget -scrollregion] 3]
if {$ymax eq {} || $ymax == 0} return
if {$ymax eq {} || $ymax == 0 || $numcommits == 0} return
set f0 [lindex $fs 0]
set f1 [lindex $fs 1]
set y0 [expr {int($f0 * $ymax)}]
Expand Down

0 comments on commit 5a7f577

Please sign in to comment.