From 06d2df29b492f0f52a2c1ed7ba336565ed537fc5 Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Wed, 4 Jan 2023 21:34:01 +0800 Subject: [PATCH] Issue #1382 - Fix invalid assert for decoder type if JXL is not built on debug builds --- image/DecoderFactory.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/image/DecoderFactory.cpp b/image/DecoderFactory.cpp index 8acffac835..916971ba6d 100644 --- a/image/DecoderFactory.cpp +++ b/image/DecoderFactory.cpp @@ -202,12 +202,16 @@ DecoderFactory::CreateAnimationDecoder(DecoderType aType, return nullptr; } - MOZ_ASSERT(aType == DecoderType::GIF || aType == DecoderType::PNG || - aType == DecoderType::WEBP + bool validDecoderType = ( + aType == DecoderType::GIF || + aType == DecoderType::PNG || + aType == DecoderType::WEBP); #ifdef MOZ_JXL - || aType == DecoderType::JXL + validDecoderType = validDecoderType || aType == DecoderType::JXL; #endif - , "Calling CreateAnimationDecoder for non-animating DecoderType"); + + MOZ_ASSERT(validDecoderType, + "Calling CreateAnimationDecoder for non-animating DecoderType"); // Create an anonymous decoder. Interaction with the SurfaceCache and the // owning RasterImage will be mediated by AnimationSurfaceProvider.