Skip to content

Commit

Permalink
grk_decompress_get_tile_image: fallback to getImage() if tile image null
Browse files Browse the repository at this point in the history
  • Loading branch information
Grok Compression committed Jan 5, 2025
1 parent d6e8d92 commit 4592a0c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/lib/core/grok.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,12 +503,15 @@ bool GRK_CALLCONV grk_set_MCT(grk_cparameters* parameters, float* pEncodingMatri
}
grk_image* GRK_CALLCONV grk_decompress_get_tile_image(grk_object* codecWrapper, uint16_t tile_index)
{
if(codecWrapper)
{
auto codec = GrkCodec::getImpl(codecWrapper);
return codec->decompressor_ ? codec->decompressor_->getImage(tile_index) : nullptr;
}
return nullptr;
if(!codecWrapper)
return nullptr;
auto codec = GrkCodec::getImpl(codecWrapper);
if(!codec->decompressor_)
return nullptr;
auto img = codec->decompressor_->getImage(tile_index);
if(!img)
img = codec->decompressor_->getImage();
return img;
}

// no-op
Expand Down

0 comments on commit 4592a0c

Please sign in to comment.