@@ -3357,6 +3357,9 @@ LIB_EXPORT struct l_tls *l_tls_new(bool server,
if (!l_key_is_supported(L_KEY_FEATURE_CRYPTO))
return NULL;
+ if (!tx_handler || !ready_handler || !disconnect_handler)
+ return NULL;
+
tls = l_new(struct l_tls, 1);
tls->server = server;
tls->rx = app_data_handler;
@@ -3561,7 +3564,8 @@ bool tls_handle_message(struct l_tls *tls, const uint8_t *message,
return true;
tls->in_callback = true;
- tls->rx(message, len, tls->user_data);
+ if (tls->rx)
+ tls->rx(message, len, tls->user_data);
tls->in_callback = false;
if (tls->pending_destroy) {