Fix template event web_server crash (#9618)

This commit is contained in:
Flo 2025-07-17 23:45:07 +02:00 committed by GitHub
parent 6178e7d6c8
commit 4378d10f45
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1620,7 +1620,9 @@ void WebServer::handle_event_request(AsyncWebServerRequest *request, const UrlMa
request->send(404);
}
static std::string get_event_type(event::Event *event) { return event->last_event_type ? *event->last_event_type : ""; }
static std::string get_event_type(event::Event *event) {
return (event && event->last_event_type) ? *event->last_event_type : "";
}
std::string WebServer::event_state_json_generator(WebServer *web_server, void *source) {
auto *event = static_cast<event::Event *>(source);