Switching from a view that shows no commit ("No commits selected") to another view, back and forth, can trigger an error like: can't read "yscreen": no such variable can't read "yscreen": no such variable while executing "expr {[yc $row] - $yscreen}" (procedure "showview" line 91) invoked from within "showview 2" invoked from within ".#bar.#bar#view invoke active" ("uplevel" body line 1) invoked from within "uplevel #0 [list $w invoke active]" (procedure "tk::MenuInvoke" line 50) invoked from within "tk::MenuInvoke .#bar.#bar#view 1" (command bound to event) This patch avoids this with a check on yscreen and ytop in procedure showview. Signed-off-by: Michele Ballabio <barra_cuda@xxxxxxxxxxxx> --- gitk | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gitk b/gitk index f1f21e9..371654f 100755 --- a/gitk +++ b/gitk @@ -2124,11 +2124,15 @@ proc showview {n} { set row $commitrow($n,$selid) # try to get the selected row in the same position on the screen set ymax [lindex [$canv cget -scrollregion] 3] - set ytop [expr {[yc $row] - $yscreen}] - if {$ytop < 0} { - set ytop 0 + if {[info exists yscreen]} { + set ytop [expr {[yc $row] - $yscreen}] + } + if {[info exists ytop]} { + if {$ytop < 0} { + set ytop 0 + } + set yf [expr {$ytop * 1.0 / $ymax}] } - set yf [expr {$ytop * 1.0 / $ymax}] } allcanvs yview moveto $yf drawvisible -- 1.5.4.3 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html