瀏覽代碼

Fix null pointer dereference when no sensors are defined (fixes #37)

Oxan van Leeuwen 2 年之前
父節點
當前提交
e37d924e93
共有 1 個文件被更改,包括 1 次插入6 次删除
  1. 1 6
      components/stream_server/stream_server.cpp

+ 1 - 6
components/stream_server/stream_server.cpp

@@ -41,12 +41,7 @@ void StreamServerComponent::setup() {
     this->socket_->bind(reinterpret_cast<struct sockaddr *>(&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() {