BUGFIX break the loop if locked_session is NULL
diff --git a/src/notification-server.c b/src/notification-server.c
index 8c15e21..e3e6461 100644
--- a/src/notification-server.c
+++ b/src/notification-server.c
@@ -271,7 +271,7 @@
 		return (NULL);
 	}
 	for (locked_session = netconf_sessions_list;
-         strcmp(nc_session_get_id(locked_session->session), session_id);
+         locked_session && strcmp(nc_session_get_id(locked_session->session), session_id);
          locked_session = locked_session->next);
 	return locked_session;
 }