X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fmessagemodel.cpp;fp=src%2Fclient%2Fmessagemodel.cpp;h=d10a9bcc1f9ea2043dd1736b79bc64f7b694263f;hp=ba5db096efe93b3388607491d773f7fccfd339e9;hb=2f4a721e0e8a1a8d36a89cadba6ace426aa5e874;hpb=6c23f5cc6fefa40c038d80f6cb90204065dba6bc diff --git a/src/client/messagemodel.cpp b/src/client/messagemodel.cpp index ba5db096..d10a9bcc 100644 --- a/src/client/messagemodel.cpp +++ b/src/client/messagemodel.cpp @@ -307,10 +307,12 @@ void MessageModel::customEvent(QEvent *event) { } void MessageModel::clear() { - beginRemoveRows(QModelIndex(), 0, rowCount() - 1); - removeAllMessages(); - endRemoveRows(); _messagesWaiting.clear(); + if (rowCount() > 0) { + beginRemoveRows(QModelIndex(), 0, rowCount() - 1); + removeAllMessages(); + endRemoveRows(); + } } // returns index of msg with given Id or of the next message after that (i.e., the index where we'd insert this msg)