This is an automated email from the ASF dual-hosted git repository. rbulter pushed a commit to branch feature/fix_tcp_endpoint_handling in repository https://gitbox.apache.org/repos/asf/celix.git
commit 7a46f24d700f9ba40d8980d2df90b9ab3fb468be Author: Roy Bulter <[email protected]> AuthorDate: Wed Apr 29 11:29:43 2020 +0200 Avoid segfault when stopping bundle --- libs/framework/src/framework.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/framework/src/framework.c b/libs/framework/src/framework.c index 586c639..3c4581a 100644 --- a/libs/framework/src/framework.c +++ b/libs/framework/src/framework.c @@ -1004,6 +1004,11 @@ celix_status_t fw_stopBundle(framework_pt framework, long bndId, bool record) { char *error = NULL; celix_framework_bundle_entry_t *entry = fw_bundleEntry_getBundleEntryAndIncreaseUseCount(framework, bndId); + if (entry == NULL) { + status = CELIX_ILLEGAL_STATE; + fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Cannot stop bundle [%ld]: cannot find bundle entry", bndId); + return status; + } if (record) { status = CELIX_DO_IF(status, bundle_setPersistentStateInactive(entry->bnd));
