#38 divide by zero

open
nobody
None
5
2007-07-03
2007-07-03
Anonymous
No

When files or versions of a file to be compared have only a single line and that line does not end with a return character, tkdiff fails due to a division by zero, or # of lines determined to be zero.
Example:

divide by zero
while executing
"expr {$mapheight / $lines}"
(procedure "create-map" line 11)
invoked from within
"create-map map $mapwidth $mapheight"
(procedure "map-resize" line 28)
invoked from within
"map-resize 0 1"

A simple 'if {$lines == 0} ... do something about it' could fix this inconvenience.

Discussion