From e37d924e931e744b6b9b5b3764d18330b447f86f Mon Sep 17 00:00:00 2001 From: Oxan van Leeuwen Date: Sat, 25 Mar 2023 18:52:20 +0100 Subject: [PATCH] Fix null pointer dereference when no sensors are defined (fixes #37) --- components/stream_server/stream_server.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/components/stream_server/stream_server.cpp b/components/stream_server/stream_server.cpp index c238579..12d58ef 100644 --- a/components/stream_server/stream_server.cpp +++ b/components/stream_server/stream_server.cpp @@ -41,12 +41,7 @@ void StreamServerComponent::setup() { this->socket_->bind(reinterpret_cast(&bind_addr), bind_addrlen); this->socket_->listen(8); -#ifdef USE_BINARY_SENSOR - this->connected_sensor_->publish_state(false); -#endif -#ifdef USE_SENSOR - this->connection_count_sensor_->publish_state(0); -#endif + this->publish_sensor(); } void StreamServerComponent::loop() {