소스 검색

LibImageDecoderClient: Decoded images with 0 frames are not successful

Previously you could pass anything (e.g a text file) to ImageDecoder and
it would "succeed" in decoding it and give you back a 0-frame result.

Let's consider that state a failure instead.
Andreas Kling 4 년 전
부모
커밋
fa0e23009a
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      Userland/Libraries/LibImageDecoderClient/Client.cpp

+ 3 - 0
Userland/Libraries/LibImageDecoderClient/Client.cpp

@@ -51,6 +51,9 @@ Optional<DecodedImage> Client::decode_image(const ByteBuffer& encoded_data)
 
     auto& response = response_or_error.value();
 
+    if (response.bitmaps().is_empty())
+        return {};
+
     DecodedImage image;
     image.is_animated = response.is_animated();
     image.loop_count = response.loop_count();