Fixed crash when importing custom theme with duplicated entries.
This commit is contained in:
parent
d2bd109169
commit
fd79973509
|
@ -225,6 +225,10 @@ void EditorBlock::feed(const QString &name, QColor value, const QString ©OfE
|
||||||
|
|
||||||
bool EditorBlock::feedCopy(const QString &name, const QString ©Of) {
|
bool EditorBlock::feedCopy(const QString &name, const QString ©Of) {
|
||||||
if (auto row = findRow(copyOf)) {
|
if (auto row = findRow(copyOf)) {
|
||||||
|
if (copyOf == name) {
|
||||||
|
LOG(("Theme Warning: Skipping value '%1: %2' (the value refers to itself.)").arg(name, copyOf));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (findRow(name)) {
|
if (findRow(name)) {
|
||||||
// Remove the existing row and mark all its copies as unique keys.
|
// Remove the existing row and mark all its copies as unique keys.
|
||||||
LOG(("Theme Warning: Color value '%1' appears more than once in the color scheme.").arg(name));
|
LOG(("Theme Warning: Color value '%1' appears more than once in the color scheme.").arg(name));
|
||||||
|
@ -232,6 +236,10 @@ bool EditorBlock::feedCopy(const QString &name, const QString ©Of) {
|
||||||
|
|
||||||
// row was invalidated by removeRow() call.
|
// row was invalidated by removeRow() call.
|
||||||
row = findRow(copyOf);
|
row = findRow(copyOf);
|
||||||
|
// Should not happen, but still check.
|
||||||
|
if (!row) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
addRow(name, copyOf, row->value());
|
addRow(name, copyOf, row->value());
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue