diff --git a/esphome/components/api/api_connection.cpp b/esphome/components/api/api_connection.cpp index a50fa41631..13c5b345b6 100644 --- a/esphome/components/api/api_connection.cpp +++ b/esphome/components/api/api_connection.cpp @@ -45,14 +45,14 @@ static const int CAMERA_STOP_STREAM = 5000; // Helper macro for entity command handlers - gets entity by key, returns if not found, and creates call object #define ENTITY_COMMAND_MAKE_CALL(entity_type, entity_var, getter_name) \ entity_type *entity_var = App.get_##getter_name##_by_key(msg.key); \ - if (entity_var == nullptr) \ + if ((entity_var) == nullptr) \ return; \ - auto call = entity_var->make_call(); + auto call = (entity_var)->make_call(); // Helper macro for entity command handlers that don't use make_call() - gets entity by key and returns if not found #define ENTITY_COMMAND_GET(entity_type, entity_var, getter_name) \ entity_type *entity_var = App.get_##getter_name##_by_key(msg.key); \ - if (entity_var == nullptr) \ + if ((entity_var) == nullptr) \ return; APIConnection::APIConnection(std::unique_ptr sock, APIServer *parent)