mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-03-13 01:26:37 -04:00
Fix potential crash in search if an entry doesn't have a group (#9633)
This commit is contained in:
parent
33b740ddd0
commit
2fe647fd7a
@ -148,7 +148,10 @@ bool EntrySearcher::searchEntryImpl(const Entry* entry)
|
|||||||
auto attributes = QStringList(attributes_keys + entry->attributes()->values(attributes_keys));
|
auto attributes = QStringList(attributes_keys + entry->attributes()->values(attributes_keys));
|
||||||
auto attachments = QStringList(entry->attachments()->keys());
|
auto attachments = QStringList(entry->attachments()->keys());
|
||||||
// Build a group hierarchy to allow searching for e.g. /group1/subgroup*
|
// Build a group hierarchy to allow searching for e.g. /group1/subgroup*
|
||||||
auto hierarchy = entry->group()->hierarchy().join('/').prepend("/");
|
QString hierarchy;
|
||||||
|
if (entry->group()) {
|
||||||
|
hierarchy = entry->group()->hierarchy().join('/').prepend("/");
|
||||||
|
}
|
||||||
|
|
||||||
// By default, empty term matches every entry.
|
// By default, empty term matches every entry.
|
||||||
// However when skipping protected fields, we will reject everything instead
|
// However when skipping protected fields, we will reject everything instead
|
||||||
@ -190,7 +193,7 @@ bool EntrySearcher::searchEntryImpl(const Entry* entry)
|
|||||||
// Match against the full hierarchy if the word contains a '/' otherwise just the group name
|
// Match against the full hierarchy if the word contains a '/' otherwise just the group name
|
||||||
if (term.word.contains('/')) {
|
if (term.word.contains('/')) {
|
||||||
found = term.regex.match(hierarchy).hasMatch();
|
found = term.regex.match(hierarchy).hasMatch();
|
||||||
} else {
|
} else if (entry->group()) {
|
||||||
found = term.regex.match(entry->group()->name()).hasMatch();
|
found = term.regex.match(entry->group()->name()).hasMatch();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user