diff --git a/libheif/codecs/uncompressed/unc_codec.cc b/libheif/codecs/uncompressed/unc_codec.cc index bd3e54a9a7..0ce5759f32 100644 --- a/libheif/codecs/uncompressed/unc_codec.cc +++ b/libheif/codecs/uncompressed/unc_codec.cc @@ -237,14 +237,14 @@ Error UncompressedImageCodec::get_heif_chroma_uncompressed(const std::shared_ptr const std::shared_ptr& cmpd, heif_chroma* out_chroma, heif_colorspace* out_colourspace) { + *out_chroma = heif_chroma_undefined; + *out_colourspace = heif_colorspace_undefined; + Error error = check_header_validity(std::nullopt, cmpd, uncC); if (error) { return error; } - *out_chroma = heif_chroma_undefined; - *out_colourspace = heif_colorspace_undefined; - if (isKnownUncompressedFrameConfigurationBoxProfile(uncC)) { *out_chroma = heif_chroma_444; *out_colourspace = heif_colorspace_RGB; @@ -438,8 +438,9 @@ Result> UncompressedImageCodec::create_image(con uint32_t height) { auto img = std::make_shared(); - heif_chroma chroma; - heif_colorspace colourspace; + heif_chroma chroma = heif_chroma_undefined; + heif_colorspace colourspace = heif_colorspace_undefined; + Error error = get_heif_chroma_uncompressed(uncC, cmpd, &chroma, &colourspace); if (error) { return error;