Skip to content

Commit

Permalink
GUI: fix crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
jdupak committed Feb 15, 2024
1 parent 0b264fd commit 0d0e88d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/gui/windows/messages/messagesmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ void MessagesModel::insert_line(
}

void MessagesModel::clear_messages() {
beginRemoveRows(QModelIndex(), 0, rowCount() - 1);
auto row_count = rowCount();
if (row_count == 0) return;
beginRemoveRows(QModelIndex(), 0, row_count - 1);
while (!messages.isEmpty()) {
delete messages.takeFirst();
}
Expand Down

0 comments on commit 0d0e88d

Please sign in to comment.