diff --git a/libheif/codecs/grid.cc b/libheif/codecs/grid.cc index 25dada0030..c76862c7db 100644 --- a/libheif/codecs/grid.cc +++ b/libheif/codecs/grid.cc @@ -494,6 +494,10 @@ int ImageItem_Grid::get_luma_bits_per_pixel() const } auto image = get_context()->get_image(child); + if (!image) { + return -1; + } + return image->get_luma_bits_per_pixel(); }