Add a null checking for heic thumbnail data.
Test: run poc with and without the patch
Bug: 79944875
Change-Id: Ie3a9610c19baef65f4a5c7e7f6b8e051b558d663
diff --git a/media/extractors/mp4/ItemTable.cpp b/media/extractors/mp4/ItemTable.cpp
index ca9deab..be442e6 100644
--- a/media/extractors/mp4/ItemTable.cpp
+++ b/media/extractors/mp4/ItemTable.cpp
@@ -1529,12 +1529,16 @@
if (thumbItemIndex >= 0) {
const ImageItem &thumbnail = mItemIdToItemMap[thumbItemIndex];
- meta->setInt32(kKeyThumbnailWidth, thumbnail.width);
- meta->setInt32(kKeyThumbnailHeight, thumbnail.height);
- meta->setData(kKeyThumbnailHVCC, kTypeHVCC,
- thumbnail.hvcc->data(), thumbnail.hvcc->size());
- ALOGV("image[%u]: thumbnail: size %dx%d, item index %zd",
- imageIndex, thumbnail.width, thumbnail.height, thumbItemIndex);
+ if (thumbnail.hvcc != NULL) {
+ meta->setInt32(kKeyThumbnailWidth, thumbnail.width);
+ meta->setInt32(kKeyThumbnailHeight, thumbnail.height);
+ meta->setData(kKeyThumbnailHVCC, kTypeHVCC,
+ thumbnail.hvcc->data(), thumbnail.hvcc->size());
+ ALOGV("image[%u]: thumbnail: size %dx%d, item index %zd",
+ imageIndex, thumbnail.width, thumbnail.height, thumbItemIndex);
+ } else {
+ ALOGW("%s: thumbnail data is missing for image[%u]!", __FUNCTION__, imageIndex);
+ }
} else {
ALOGW("%s: Referenced thumbnail does not exist!", __FUNCTION__);
}