From: Bruno Bigras Date: Tue, 19 Jan 2010 16:58:23 +0000 (-0500) Subject: Prevent quasselclient from crashing when using the 'cancel' button of the 'Authorisat... X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=2f4a721e0e8a1a8d36a89cadba6ace426aa5e874 Prevent quasselclient from crashing when using the 'cancel' button of the 'Authorisation is required' dialog --- 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)