Adds NULL check to http_admin based on review comments
* specific language governing permissions and limitations
* under the License.
*/
-/**
- * service_tree.c
- *
- * \date Jun 19, 2019
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
#include <stdlib.h>
#include <stdbool.h> //for `bool`
@@ -308,7 +301,9 @@ service_tree_node_t *findServiceNodeInTree(service_tree_t *svc_tree, const char
char *uri_token = strtok_r(uri_cpy, "/", &save_ptr);
//Check for horizontal matches for the first token
while (current != NULL) {
- if (uri_token != NULL && strcmp(current->svc_data->sub_uri, uri_token) == 0){
+ if (uri_token == NULL) {
+ current = NULL;
+ } else if (strcmp(current->svc_data->sub_uri, uri_token) == 0){
//Save current node to comply with OSGI Http Whiteboard Specification
if (current->svc_data->service != NULL) {
found_node = current;
