Skip to content

Commit

Permalink
with checkNotNull] fbandroid/libraries/fresco/animated-gif-lite/src/m…
Browse files Browse the repository at this point in the history
…ain/java/com/facebook/animated/giflite/GifDecoder.java

Reviewed By: jocelynluizzi13

Differential Revision: D68764961

fbshipit-source-id: d73802bb6b42734990e86571140f58df7a776fab
  • Loading branch information
generatedunixname89002005287564 authored and facebook-github-bot committed Jan 28, 2025
1 parent 587ee66 commit fd7416a
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.facebook.animated.giflite.draw.MovieAnimatedImage;
import com.facebook.animated.giflite.draw.MovieDrawer;
import com.facebook.animated.giflite.draw.MovieFrame;
import com.facebook.common.preconditions.Preconditions;
import com.facebook.imagepipeline.animated.base.AnimatedDrawableFrameInfo;
import com.facebook.imagepipeline.animated.base.AnimatedImageResult;
import com.facebook.imagepipeline.common.ImageDecodeOptions;
Expand Down Expand Up @@ -44,15 +45,12 @@ public CloseableImage decode(
GifMetadataDecoder decoder = GifMetadataDecoder.create(is, out);

if (out.size() > 0) { // let's use the fixed gif version if exists
// NULLSAFE_FIXME[Nullable Dereference]
is.close();
Preconditions.checkNotNull(is).close();
is = new ByteArrayInputStream(out.toByteArray());
}

// NULLSAFE_FIXME[Nullable Dereference]
is.reset();
Preconditions.checkNotNull(is).reset();

// NULLSAFE_FIXME[Parameter Not Nullable]
Movie movie = Movie.decodeStream(is);

MovieDrawer drawer = new MovieDrawer(movie);
Expand Down Expand Up @@ -84,8 +82,7 @@ public CloseableImage decode(
throw new RuntimeException("Error while decoding gif", e);
} finally {
try {
// NULLSAFE_FIXME[Nullable Dereference]
is.close();
Preconditions.checkNotNull(is).close();
} catch (IOException ignored) {
}
}
Expand Down

0 comments on commit fd7416a

Please sign in to comment.