From 203b4a3ff07db00a07b60b3dc248d52acf9ffaf5 Mon Sep 17 00:00:00 2001 From: zdia Date: Wed, 13 Feb 2013 20:19:15 +0100 Subject: [PATCH] Fix for issue #105: not initialized variable gorilla::fileName --- sources/gorilla.tcl | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sources/gorilla.tcl b/sources/gorilla.tcl index d43b1ec..8cb85d5 100755 --- a/sources/gorilla.tcl +++ b/sources/gorilla.tcl @@ -4540,7 +4540,8 @@ proc gorilla::SaveAs {} { set ::gorilla::status [mc "Password database saved."] return GORILLA_OK -} + +} ; # end proc gorilla::SaveAs proc gorilla::filename_query {type args} { @@ -4976,9 +4977,17 @@ proc gorilla::LockDatabase {} { rename ::tk::mac::ShowPreferences "" } - # FIXME: perhaps it's better to backup the db in any case? if { $::gorilla::preference(keepBackupFile) } { - set message [ gorilla::SaveBackup $::gorilla::fileName ] + + if { ![info exists ::gorilla::fileName] } { + set nosave [tk_dialog .nosave [mc "Database not saved!"] \ + [mc "This database has not been saved. Do you want to save it now?"] \ + "" 0 [mc Yes] [mc No] ] + if {$nosave} { set message GORILLA_OK + } else { set message [gorilla::SaveAs] } + + } else { set message [ gorilla::SaveBackup $::gorilla::fileName ] } + if { $message ne "GORILLA_OK" } { gorilla::ErrorPopup [lindex $message 0] [lindex $message 1] }