Fix crash when deleting an entry and the backup group doesn't exist

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@303 b624d157-de02-0410-bad0-e51aec6abb33
master
sniperbeamer 16 years ago
parent a1969ef210
commit cde51763aa
  1. 6
      src/lib/EntryView.cpp

@ -155,9 +155,13 @@ void KeepassEntryView::OnDeleteEntry(){
IGroupHandle* bGroup;
if (config->backup() && ((EntryViewItem*)entries[0])->EntryHandle->group() != (bGroup=db->backupGroup()))
backup = true;
if (backup && !bGroup) {
emit requestCreateGroup("Backup", 4, NULL);
bGroup = db->backupGroup();
}
for(int i=0; i<entries.size();i++){
IEntryHandle* entryHandle = ((EntryViewItem*)entries[i])->EntryHandle;
if (backup){
if (backup && bGroup){
db->moveEntry(entryHandle, bGroup);
QDateTime now = QDateTime::currentDateTime();
entryHandle->setLastAccess(now);