소스 검색

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

Oxan van Leeuwen 3 년 전
부모
커밋
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() {