session: segment manager improvements
[vpp.git] / src / vnet / session / session.c
index 6fe9904..ee22ccb 100644 (file)
@@ -457,7 +457,10 @@ stream_session_connect_notify (transport_connection_t * tc, u8 is_fail)
   /* Get the app's index from the handle we stored when opening connection
    * and the opaque (api_context for external apps) from transport session
    * index*/
-  app = application_get (handle >> 32);
+  app = application_get_if_valid (handle >> 32);
+  if (!app)
+    return -1;
+
   opaque = tc->s_index;
 
   if (!is_fail)
@@ -562,9 +565,7 @@ stream_session_delete_notify (transport_connection_t * tc)
   /* App might've been removed already */
   s = stream_session_get_if_valid (tc->s_index, tc->thread_index);
   if (!s)
-    {
-      return;
-    }
+    return;
   stream_session_delete (s);
 }