fixed multiline history
[quassel.git] / src / uisupport / nickview.cpp
index 6d3f398..bdba62f 100644 (file)
@@ -124,11 +124,7 @@ void NickView::startQuery(const QModelIndex &index) {
   if(!ircUser || !networkId.isValid())
     return;
 
-  BufferId bufId = Client::networkModel()->bufferId(networkId, ircUser->nick());
-  if(bufId.isValid())
-    Client::bufferModel()->switchToBuffer(bufId);
-  else
-    Client::userInput(index.data(NetworkModel::BufferInfoRole).value<BufferInfo>(), QString("/QUERY %1").arg(ircUser->nick()));
+  Client::bufferModel()->switchToOrStartQuery(networkId, ircUser->nick());
 }
 
 void NickView::customEvent(QEvent *event) {
@@ -144,6 +140,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());