From 7365f5e219f96f9c4ef555900b082cedc1d52727 Mon Sep 17 00:00:00 2001 From: Kjell Braden Date: Thu, 14 Nov 2024 11:37:35 +0100 Subject: [PATCH] online_image: replace c++17 syntax --- esphome/components/online_image/online_image.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/esphome/components/online_image/online_image.cpp b/esphome/components/online_image/online_image.cpp index 797ae4dc9e..5caf5deb63 100644 --- a/esphome/components/online_image/online_image.cpp +++ b/esphome/components/online_image/online_image.cpp @@ -104,10 +104,12 @@ void OnlineImage::update() { } std::list headers; - for (const auto &[key, value_template] : this->headers_) { - auto val = value_template(); - if (val.has_value()) { - headers.push_back(http_request::Header{key, *val}); + for (const auto &item : this->headers_) { + auto header_name = item.first; + auto header_value_template = item.second; + auto header_value = header_value_template(); + if (header_value.has_value()) { + headers.push_back(http_request::Header{header_name, *header_value}); } }