From 0222cd25b07a0e00cfec480f98632c2e231adb88 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Tue, 17 Jul 2018 18:28:23 +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 b9b2564a7..404506f12 100644 --- a/lib/core/libwebsockets.c +++ b/lib/core/libwebsockets.c @@ -2162,6 +2162,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); }