[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 Jesse Hills
parent e623989878
commit 3bac45e737
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A

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;