From 264583fe7d25bf3ac67468cab7fbcf60344778c7 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Tue, 17 Jul 2018 18:29:25 +0800 Subject: [PATCH] lws_get_peer_write_allowance: cope with no role callback for it https://github.com/warmcat/libwebsockets/issues/1339 --- lib/core/libwebsockets.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/core/libwebsockets.c b/lib/core/libwebsockets.c index cbfd8bc9e..d614583f9 100644 --- a/lib/core/libwebsockets.c +++ b/lib/core/libwebsockets.c @@ -2123,6 +2123,8 @@ lws_partial_buffered(struct lws *wsi) LWS_VISIBLE lws_fileofs_t lws_get_peer_write_allowance(struct lws *wsi) { + if (!wsi->role_ops->tx_credit) + return -1; return wsi->role_ops->tx_credit(wsi); }