Add defensive null check.


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1684635 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java b/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
index 16ab677..e23f640 100644
--- a/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
+++ b/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
@@ -419,7 +419,8 @@
             {
                 if (count == 0)
                 {
-                    Object svc = usage.m_svcHolderRef.getAndSet(null).m_service;
+                    ServiceHolder holder = usage.m_svcHolderRef.getAndSet(null);
+                    Object svc = holder != null ? holder.m_service : null;
 
                     // Remove reference from usages array.
                     ((ServiceRegistrationImpl.ServiceReferenceImpl) ref)