From 3bac45e737655af9f8fbf7734e3a17620fcdec47 Mon Sep 17 00:00:00 2001 From: guillempages Date: Thu, 28 Nov 2024 04:55:20 +0100 Subject: [PATCH] [online_image]Don't access decoder if not initialized (#7882) --- esphome/components/online_image/png_image.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/esphome/components/online_image/png_image.cpp b/esphome/components/online_image/png_image.cpp index c8e215a91d..4c4c22f9b7 100644 --- a/esphome/components/online_image/png_image.cpp +++ b/esphome/components/online_image/png_image.cpp @@ -49,6 +49,10 @@ void PngDecoder::prepare(uint32_t download_size) { } int HOT PngDecoder::decode(uint8_t *buffer, size_t size) { + if (!this->pngle_) { + ESP_LOGE(TAG, "PNG decoder engine not initialized!"); + return -1; + } if (size < 256 && size < this->download_size_ - this->decoded_bytes_) { ESP_LOGD(TAG, "Waiting for data"); return 0;