fixing client crash during core init
[quassel.git] / src / client / client.cpp
index a6f7b4b..e936be5 100644 (file)
@@ -72,8 +72,8 @@ Client::Client(QObject *parent)
     _bufferSyncer(0),
     _backlogManager(new ClientBacklogManager(this)),
     _bufferViewManager(0),
-    _messageModel(0),
     _ircListHelper(new ClientIrcListHelper(this)),
+    _messageModel(0),
     _connectedToCore(false),
     _syncedToCore(false)
 {
@@ -246,7 +246,8 @@ void Client::coreNetworkCreated(NetworkId id) {
 }
 
 void Client::coreNetworkRemoved(NetworkId id) {
-  if(!_networks.contains(id)) return;
+  if(!_networks.contains(id))
+    return;
   Network *net = _networks.take(id);
   emit networkRemoved(net->networkId());
   net->deleteLater();
@@ -586,7 +587,9 @@ void Client::checkForHighlight(Message &msg) {
     if(notificationSettings.highlightNick() == NotificationSettings::CurrentNick) {
       nickList << net->myNick();
     } else if(notificationSettings.highlightNick() == NotificationSettings::AllNicks) {
-      nickList = identity(net->identity())->nicks();
+      const Identity *myIdentity = identity(net->identity());
+      if(myIdentity)
+       nickList = myIdentity->nicks();
     }
     foreach(QString nickname, nickList) {
       QRegExp nickRegExp("^(.*\\W)?" + QRegExp::escape(nickname) + "(\\W.*)?$");
@@ -641,10 +644,11 @@ void Client::removeBuffer(BufferId id) {
 }
 
 void Client::bufferRemoved(BufferId bufferId) {
-  // first remove the buffer from has. this prohibits further lastSeenUpdates
+  // first remove the buffer from hash. this prohibits further lastSeenUpdates
   Buffer *buff = 0;
   if(_buffers.contains(bufferId)) {
     buff = _buffers.take(bufferId);
+    layoutQueue.removeAll(buff);
     disconnect(buff, 0, this, 0);
   }