diff options
Diffstat (limited to 'src/deps/libuwsockets.cpp')
| -rw-r--r-- | src/deps/libuwsockets.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/deps/libuwsockets.cpp b/src/deps/libuwsockets.cpp index cbf399f20..1533787ee 100644 --- a/src/deps/libuwsockets.cpp +++ b/src/deps/libuwsockets.cpp @@ -1261,14 +1261,22 @@ extern "C" if (ssl) { uWS::HttpResponse<true> *uwsRes = (uWS::HttpResponse<true> *)res; - uwsRes->onData([handler, res, opcional_data](auto chunk, bool is_end) - { handler(res, chunk.data(), chunk.length(), is_end, opcional_data); }); + if (handler) { + uwsRes->onData([handler, res, opcional_data](auto chunk, bool is_end) + { handler(res, chunk.data(), chunk.length(), is_end, opcional_data); }); + } else { + uwsRes->onData(nullptr); + } } else { uWS::HttpResponse<false> *uwsRes = (uWS::HttpResponse<false> *)res; - uwsRes->onData([handler, res, opcional_data](auto chunk, bool is_end) - { handler(res, chunk.data(), chunk.length(), is_end, opcional_data); }); + if (handler) { + uwsRes->onData([handler, res, opcional_data](auto chunk, bool is_end) + { handler(res, chunk.data(), chunk.length(), is_end, opcional_data); }); + } else { + uwsRes->onData(nullptr); + } } } |
