Avoid std::bad_function_call if we don't specify an onreceive callback for the WebSocket

This commit is contained in:
David Capello 2021-10-19 11:12:15 -03:00
parent c2f24656d7
commit 5c30315611

View File

@ -107,6 +107,8 @@ int WebSocket_new(lua_State* L)
});
}
else {
// Set a default handler to avoid a std::bad_function_call exception
ws->setOnMessageCallback([](const ix::WebSocketMessagePtr& msg) { });
lua_pop(L, 1);
}
}