diff --git a/src/ssb.c b/src/ssb.c index 614ef94d..3b7c42bc 100644 --- a/src/ssb.c +++ b/src/ssb.c @@ -2862,6 +2862,10 @@ static void _tf_ssb_connection_tunnel_callback( tf_ssb_connection_t* tf_ssb_connection_tunnel_create(tf_ssb_t* ssb, const char* portal_id, int32_t request_number, const char* target_id, int connect_flags) { tf_ssb_connection_t* connection = tf_ssb_connection_get(ssb, portal_id); + if (!connection) + { + return NULL; + } JSContext* context = ssb->context; tf_ssb_connection_t* tunnel = tf_malloc(sizeof(tf_ssb_connection_t)); @@ -4446,8 +4450,7 @@ bool tf_ssb_tunnel_create(tf_ssb_t* ssb, const char* portal_id, const char* targ tf_ssb_connection_rpc_send_json(connection, k_ssb_rpc_flag_stream | k_ssb_rpc_flag_new_request, request_number, "tunnel.connect", message, NULL, NULL, NULL); JS_FreeValue(context, message); - tf_ssb_connection_tunnel_create(ssb, portal_id, request_number, target_id, connect_flags); - return true; + return tf_ssb_connection_tunnel_create(ssb, portal_id, request_number, target_id, connect_flags) != NULL; } return false; }