Skip to content

Commit e972a29

Browse files
committed
Fix possible crash in theme editor.
1 parent 02bf8e5 commit e972a29

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎Telegram/SourceFiles/window/themes/window_theme_editor_block.cpp‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,10 @@ void EditorBlock::checkCopiesChanged(int startIndex, QStringList names, QColor v
637637
}
638638

639639
void EditorBlock::cancelEditing() {
640-
if (_editing >= 0) {
640+
// The only place we need to check for _editing < _data.size(),
641+
// because we could remove the row that was edited in New block,
642+
// and it could be the last row, making _editing inconsistent.
643+
if (_editing >= 0 && _editing < _data.size()) {
641644
updateRow(_data[_editing]);
642645
}
643646
_editing = -1;

0 commit comments

Comments
 (0)