From 17492fb6c867296692b782227de660d352545f73 Mon Sep 17 00:00:00 2001 From: Bruno Bigras Date: Tue, 19 Jan 2010 11:58:23 -0500 Subject: [PATCH] Prevent quasselclient from crashing when using the 'cancel' button of the 'Authorisation is required' dialog --- src/client/messagemodel.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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) -- 2.20.1