Skip to content

Commit

Permalink
Fix crash when building history changes
Browse files Browse the repository at this point in the history
* Replace rarely hit asserts with defined nullptr checks when replacing references without a group
* Fix keepassxreboot#7603
* Replace TOTP history comparison with checking the actual TOTP output instead of a compiled string
  • Loading branch information
droidmonkey committed Apr 3, 2022
1 parent 48a3fd8 commit 44be95c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/core/Entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ QString Entry::resolveReferencePlaceholderRecursive(const QString& placeholder,
// using format from http://keepass.info/help/base/fieldrefs.html at the time of writing

QRegularExpressionMatch match = EntryAttributes::matchReference(placeholder);
if (!match.hasMatch()) {
if (!match.hasMatch() || !m_group || !m_group->database()) {
return placeholder;
}

Expand All @@ -1149,8 +1149,6 @@ QString Entry::resolveReferencePlaceholderRecursive(const QString& placeholder,

const EntryReferenceType searchInType = Entry::referenceType(searchIn);

Q_ASSERT(m_group);
Q_ASSERT(m_group->database());
const Entry* refEntry = m_group->database()->rootGroup()->findEntryBySearchTerm(searchText, searchInType);

if (refEntry) {
Expand Down
2 changes: 1 addition & 1 deletion src/gui/entry/EntryHistoryModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ void EntryHistoryModel::calculateHistoryModifications()
|| curr->timeInfo().expiryTime() != compare->timeInfo().expiryTime()) {
modifiedFields << tr("Expiration");
}
if (curr->totpSettingsString() != compare->totpSettingsString()) {
if (curr->totp() != compare->totp()) {
modifiedFields << tr("TOTP");
}
if (*curr->customData() != *compare->customData()) {
Expand Down

0 comments on commit 44be95c

Please sign in to comment.