1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-02 19:32:19 +01:00

[online_image]Don't access decoder if not initialized (#7882)

This commit is contained in:
guillempages
2024-11-28 04:55:20 +01:00
committed by GitHub
parent 7cdf5b55ef
commit beb8ab50e2

View File

@@ -49,6 +49,10 @@ void PngDecoder::prepare(uint32_t download_size) {
} }
int HOT PngDecoder::decode(uint8_t *buffer, size_t 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_) { if (size < 256 && size < this->download_size_ - this->decoded_bytes_) {
ESP_LOGD(TAG, "Waiting for data"); ESP_LOGD(TAG, "Waiting for data");
return 0; return 0;