From 12852eb3772aab0006ed63202238c19ba3702b95 Mon Sep 17 00:00:00 2001 From: plfiorini Date: Fri, 28 May 2010 17:20:02 +0000 Subject: [PATCH] Fix crash when msn plugin is not installed. When the protocol looper is set we get its CayaProtocolAddOn and retrieve the protocol add-on's icon that is used as the default icon for the contact. --- application/ContactLinker.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/application/ContactLinker.cpp b/application/ContactLinker.cpp index 97f5047..60f05ab 100644 --- a/application/ContactLinker.cpp +++ b/application/ContactLinker.cpp @@ -13,12 +13,14 @@ #include "ContactLinker.h" #include "ContactPopUp.h" #include "NotifyMessage.h" +#include "ProtocolLooper.h" #include "ProtocolManager.h" #include "RosterItem.h" #include "WindowsManager.h" #include "CayaPreferences.h" + ContactLinker::ContactLinker(BString id, BMessenger msgn) : fChatWindow(NULL), @@ -32,10 +34,6 @@ ContactLinker::ContactLinker(BString id, BMessenger msgn) // Create the roster item and register it as observer fRosterItem = new RosterItem(id.String(), this); RegisterObserver(fRosterItem); - - // By default we use protocol icon as avatar icon - CayaProtocolAddOn* addOn = ProtocolManager::Get()->ProtocolAddOn("msn"); - fAvatarBitmap = addOn->Icon(); } @@ -145,8 +143,15 @@ ContactLinker::GetProtocolLooper() const void ContactLinker::SetProtocolLooper(ProtocolLooper* looper) { - if (looper) + if (looper) { fLooper = looper; + + // By default we use protocol icon as avatar icon + CayaProtocol* protocol = fLooper->Protocol(); + CayaProtocolAddOn* addOn + = ProtocolManager::Get()->ProtocolAddOn(protocol->Signature()); + fAvatarBitmap = addOn->Icon(); + } }