X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fmessagemodel.cpp;h=d10a9bcc1f9ea2043dd1736b79bc64f7b694263f;hp=ba5db096efe93b3388607491d773f7fccfd339e9;hb=17492fb6c867296692b782227de660d352545f73;hpb=91d4d49abb5e1a8dabba5ae5e460981afda0a354 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)