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
This commit is contained in:
parent
a1969ef210
commit
cde51763aa
|
@ -155,9 +155,13 @@ void KeepassEntryView::OnDeleteEntry(){
|
||||||
IGroupHandle* bGroup;
|
IGroupHandle* bGroup;
|
||||||
if (config->backup() && ((EntryViewItem*)entries[0])->EntryHandle->group() != (bGroup=db->backupGroup()))
|
if (config->backup() && ((EntryViewItem*)entries[0])->EntryHandle->group() != (bGroup=db->backupGroup()))
|
||||||
backup = true;
|
backup = true;
|
||||||
|
if (backup && !bGroup) {
|
||||||
|
emit requestCreateGroup("Backup", 4, NULL);
|
||||||
|
bGroup = db->backupGroup();
|
||||||
|
}
|
||||||
for(int i=0; i<entries.size();i++){
|
for(int i=0; i<entries.size();i++){
|
||||||
IEntryHandle* entryHandle = ((EntryViewItem*)entries[i])->EntryHandle;
|
IEntryHandle* entryHandle = ((EntryViewItem*)entries[i])->EntryHandle;
|
||||||
if (backup){
|
if (backup && bGroup){
|
||||||
db->moveEntry(entryHandle, bGroup);
|
db->moveEntry(entryHandle, bGroup);
|
||||||
QDateTime now = QDateTime::currentDateTime();
|
QDateTime now = QDateTime::currentDateTime();
|
||||||
entryHandle->setLastAccess(now);
|
entryHandle->setLastAccess(now);
|
||||||
|
|
Loading…
Reference in New Issue