celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject celix git commit: CELIX-452: Adds a missing null check
Date Tue, 17 Jul 2018 20:22:57 GMT
Repository: celix
Updated Branches:
  refs/heads/develop 246369eb5 -> ba03fb885


CELIX-452: Adds a missing null check


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/ba03fb88
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/ba03fb88
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/ba03fb88

Branch: refs/heads/develop
Commit: ba03fb885f09cbba0bf1350a29eb39667318ea14
Parents: 246369e
Author: Pepijn Noltes <pepijnnoltes@gmail.com>
Authored: Tue Jul 17 22:22:39 2018 +0200
Committer: Pepijn Noltes <pepijnnoltes@gmail.com>
Committed: Tue Jul 17 22:22:39 2018 +0200

----------------------------------------------------------------------
 libs/framework/src/framework.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/ba03fb88/libs/framework/src/framework.c
----------------------------------------------------------------------
diff --git a/libs/framework/src/framework.c b/libs/framework/src/framework.c
index 2bd5d84..4335cf1 100644
--- a/libs/framework/src/framework.c
+++ b/libs/framework/src/framework.c
@@ -1640,12 +1640,14 @@ void fw_removeServiceListener(framework_pt framework, bundle_pt bundle,
celix_se
 
             fw_getService(framework, framework->bundle, ref, (const void **) &hook);
 
-            arrayList_create(&infos);
-            arrayList_add(infos, &info);
-            hook->removed(hook->handle, infos);
-            serviceRegistry_ungetService(framework->registry, framework->bundle, ref,
&ungetResult);
-            serviceRegistry_ungetServiceReference(framework->registry, framework->bundle,
ref);
-            arrayList_destroy(infos);
+            if (hook != NULL) {
+                arrayList_create(&infos);
+                arrayList_add(infos, &info);
+                hook->removed(hook->handle, infos);
+                serviceRegistry_ungetService(framework->registry, framework->bundle,
ref, &ungetResult);
+                serviceRegistry_ungetServiceReference(framework->registry, framework->bundle,
ref);
+                arrayList_destroy(infos);
+            }
         }
         arrayList_destroy(listenerHooks);
     }


Mime
View raw message