From 543d0bfdb5fbea0f72fbd0504a2bbd24bcd58074 Mon Sep 17 00:00:00 2001 From: Benoit Pradelle Date: Sat, 25 Oct 2008 06:51:17 +0000 Subject: [PATCH] Fix a null pointer exception that arise when I tried to create a group on AIM when disconnected from the network. --- .../contactlist/MetaContactListServiceImpl.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/net/java/sip/communicator/impl/contactlist/MetaContactListServiceImpl.java b/src/net/java/sip/communicator/impl/contactlist/MetaContactListServiceImpl.java index 50da78d15..113e3a78e 100644 --- a/src/net/java/sip/communicator/impl/contactlist/MetaContactListServiceImpl.java +++ b/src/net/java/sip/communicator/impl/contactlist/MetaContactListServiceImpl.java @@ -507,9 +507,6 @@ private ContactGroup resolveProtoPath(ProtocolProviderService protoProvider, throw new NullPointerException("Internal Error. Orphan group."); } - ContactGroup parentProtoGroup - = resolveProtoPath(protoProvider, parentMetaGroup); - OperationSetPersistentPresence opSetPersPresence = (OperationSetPersistentPresence) protoProvider .getSupportedOperationSets().get(OperationSetPersistentPresence @@ -522,6 +519,15 @@ private ContactGroup resolveProtoPath(ProtocolProviderService protoProvider, return null; } + ContactGroup parentProtoGroup; + // special treatment for the root group (stop the recursion) + if (parentMetaGroup.getParentMetaContactGroup() == null) { + parentProtoGroup = opSetPersPresence. + getServerStoredContactListRoot(); + } else { + parentProtoGroup = resolveProtoPath(protoProvider, parentMetaGroup); + } + //create the proto group BlockingGroupEventRetriever evtRetriever = new BlockingGroupEventRetriever(metaGroup.getGroupName()); @@ -722,7 +728,7 @@ public void createMetaContactGroup(MetaContactGroup parent, MetaContactGroupImpl newMetaGroup = new MetaContactGroupImpl(groupName); ( (MetaContactGroupImpl) parent).addSubgroup(newMetaGroup); - + //fire the event fireMetaContactGroupEvent(newMetaGroup , null, null, MetaContactGroupEvent. META_CONTACT_GROUP_ADDED);