Don't crash on creating a ChatView containing redirected messages
[quassel.git] / src / qtui / chatscene.cpp
index 19f48ff..411cdb8 100644 (file)
@@ -92,15 +92,15 @@ ChatScene::ChatScene(QAbstractItemModel *model, const QString &idString, qreal w
 
   setHandleXLimits();
 
+  if(model->rowCount() > 0)
+    rowsInserted(QModelIndex(), 0, model->rowCount() - 1);
+
   connect(model, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
           this, SLOT(rowsInserted(const QModelIndex &, int, int)));
   connect(model, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)),
           this, SLOT(rowsAboutToBeRemoved(const QModelIndex &, int, int)));
   connect(model, SIGNAL(dataChanged(QModelIndex, QModelIndex)), SLOT(dataChanged(QModelIndex, QModelIndex)));
 
-  if(model->rowCount() > 0)
-    rowsInserted(QModelIndex(), 0, model->rowCount() - 1);
-
 #ifdef HAVE_WEBKIT
   webPreview.timer.setSingleShot(true);
   connect(&webPreview.timer, SIGNAL(timeout()), this, SLOT(webPreviewNextStep()));