if {$last_clicked ne {}} {
set lno [lindex $last_clicked 1]
} else {
- if {[llength $file_lists($w)] == 0} {
+ if {![info exists file_lists]
+ || ![info exists file_lists($w)]
+ || [llength $file_lists($w)] == 0} {
set last_clicked {}
return
}
}
}
- set path [lindex $file_lists($w) [expr {$lno - 1}]]
+ if {![info exists file_lists]
+ || ![info exists file_lists($w)]
+ || [llength $file_lists($w)] < $lno - 1} {
+ set path {}
+ } else {
+ set path [lindex $file_lists($w) [expr {$lno - 1}]]
+ }
if {$path eq {}} {
set last_clicked {}
return