forked from qt-creator/qt-creator
Utils: Fix invalid iterator access in NameValueDictionary
Introduced by over-eager code optimization in 4d71c0f13e
.
Fixes: QTCREATORBUG-22783
Change-Id: I2706061f59f5070f2bfa5ac61953b908527065ed
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
This commit is contained in:
@@ -149,7 +149,7 @@ NameValueItems NameValueDictionary::diff(const NameValueDictionary &other, bool
|
||||
|
||||
NameValueItems result;
|
||||
while (thisIt != constEnd() || otherIt != other.constEnd()) {
|
||||
if (thisIt == constEnd() || thisIt.key() > otherIt.key()) {
|
||||
if (thisIt == constEnd()) {
|
||||
result.append({otherIt.key(), otherIt.value().first,
|
||||
otherIt.value().second ? NameValueItem::SetEnabled : NameValueItem::SetDisabled});
|
||||
++otherIt;
|
||||
@@ -159,6 +159,10 @@ NameValueItems NameValueDictionary::diff(const NameValueDictionary &other, bool
|
||||
} else if (thisIt.key() < otherIt.key()) {
|
||||
result.append(NameValueItem(thisIt.key(), QString(), NameValueItem::Unset));
|
||||
++thisIt;
|
||||
} else if (thisIt.key() > otherIt.key()) {
|
||||
result.append({otherIt.key(), otherIt.value().first,
|
||||
otherIt.value().second ? NameValueItem::SetEnabled : NameValueItem::SetDisabled});
|
||||
++otherIt;
|
||||
} else {
|
||||
const QString &oldValue = thisIt.value().first;
|
||||
const QString &newValue = otherIt.value().first;
|
||||
|
Reference in New Issue
Block a user