From 5a7f577dcedeff60e5267fd9efbfb05987a359e4 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Tue, 15 Jan 2008 22:45:36 +1100 Subject: [PATCH] gitk: Fix bug causing Tcl error when no commits are selected Some of the stuff that commit 31c0eaa8cc10944ebca8aa31fb59f0b77b1b6e77 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 --- gitk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitk b/gitk index 322ac93f8..c060ce98c 100755 --- a/gitk +++ b/gitk @@ -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)}] -- 2.30.2