mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Fixed crash when importing custom theme with duplicated entries.
This commit is contained in:
parent
d2bd109169
commit
fd79973509
1 changed files with 8 additions and 0 deletions
|
@ -225,6 +225,10 @@ void EditorBlock::feed(const QString &name, QColor value, const QString ©OfE
|
|||
|
||||
bool EditorBlock::feedCopy(const QString &name, const QString ©Of) {
|
||||
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)) {
|
||||
// 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));
|
||||
|
@ -232,6 +236,10 @@ bool EditorBlock::feedCopy(const QString &name, const QString ©Of) {
|
|||
|
||||
// row was invalidated by removeRow() call.
|
||||
row = findRow(copyOf);
|
||||
// Should not happen, but still check.
|
||||
if (!row) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
addRow(name, copyOf, row->value());
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue