/* 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)
/* 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);
}