Make sure NickView::customEvent() has a valid model
authorManuel Nickschas <sputnick@quassel-irc.org>
Mon, 9 Nov 2009 00:44:24 +0000 (01:44 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 9 Nov 2009 00:44:24 +0000 (01:44 +0100)
We've gotten backtraces that indicate crashes in this method, and all that I can
see could be wrong is an invalid model() pointer. Can't really explain that for now,
but let's introduce a check just to make sure.

src/uisupport/nickview.cpp

index 6d3f398..11b40c7 100644 (file)
@@ -144,6 +144,9 @@ void NickView::customEvent(QEvent *event) {
   if(event->type() != QEvent::User)
     return;
 
+  if(!model())
+    return;
+
   QModelIndex topLevelIdx;
   for(int i = 0; i < model()->rowCount(rootIndex()); i++) {
     topLevelIdx = model()->index(i, 0, rootIndex());