diff --git a/src/apis/http.cpp b/src/apis/http.cpp index 2794a31f..5148145c 100644 --- a/src/apis/http.cpp +++ b/src/apis/http.cpp @@ -1378,8 +1378,8 @@ static int websocket_server_close(lua_State *L) { lastCFunction = __func__; Computer * comp = get_comp(L); websocket_server::Factory * f = *(websocket_server::Factory**)lua_touserdata(L, lua_upvalueindex(1)); - comp->openWebsocketServers.erase(f->srv->port()); if (f == NULL) return 0; + comp->openWebsocketServers.erase(f->srv->port()); f->srv->stop(); delete f->srv; *(websocket_server::Factory**)lua_touserdata(L, lua_upvalueindex(1)) = NULL; @@ -1390,8 +1390,8 @@ static int websocket_server_free(lua_State *L) { lastCFunction = __func__; Computer * comp = get_comp(L); websocket_server::Factory * f = *(websocket_server::Factory**)lua_touserdata(L, 1); - comp->openWebsocketServers.erase(f->srv->port()); if (f == NULL) return 0; + comp->openWebsocketServers.erase(f->srv->port()); f->srv->stop(); delete f->srv; *(websocket_server::Factory**)lua_touserdata(L, 1) = NULL;