From 15db11c0e60e1d82f8fe4f405c1a97cace71edca Mon Sep 17 00:00:00 2001 From: Marko Mikulicic Date: Fri, 11 Nov 2016 09:16:24 +0100 Subject: [PATCH] Fix tunnel teardown PUBLISHED_FROM=2c23e4a4dfc7129da657c5935f06335fc022394a --- mongoose.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mongoose.c b/mongoose.c index 22ab39ca..e5ec8147 100644 --- a/mongoose.c +++ b/mongoose.c @@ -3998,9 +3998,11 @@ void mg_tun_if_destroy_conn(struct mg_connection *nc) { uint32_t stream_id = (uint32_t)(uintptr_t) nc->mgr_data; struct mg_str msg = {NULL, 0}; - LOG(LL_DEBUG, ("closing %zu:", stream_id)); - mg_tun_send_frame(client->disp, stream_id, MG_TUN_DATA_FRAME, - MG_TUN_F_END_STREAM, msg); + if (client->disp) { + LOG(LL_DEBUG, ("closing %zu:", stream_id)); + mg_tun_send_frame(client->disp, stream_id, MG_TUN_DATA_FRAME, + MG_TUN_F_END_STREAM, msg); + } } /* Associate a socket to a connection. */