From 9ca8c5480c0e39511a0fe819f58646365729ebbf Mon Sep 17 00:00:00 2001 From: Mauricio Colli Date: Tue, 9 May 2017 00:12:06 -0300 Subject: [PATCH] Fix image loader bug --- app/src/main/java/org/schabi/newpipe/player/BasePlayer.java | 1 + .../main/java/org/schabi/newpipe/player/PopupVideoPlayer.java | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java b/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java index 6a85d96f4..fb010481d 100644 --- a/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java @@ -189,6 +189,7 @@ public abstract class BasePlayer implements ExoPlayer.EventListener, AudioManage ImageLoader.getInstance().loadImage(videoThumbnailUrl, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { + if (simpleExoPlayer == null) return; if (DEBUG) Log.d(TAG, "onLoadingComplete() called with: imageUri = [" + imageUri + "], view = [" + view + "], loadedImage = [" + loadedImage + "]"); videoThumbnail = loadedImage; onThumbnailReceived(loadedImage); diff --git a/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java index 0bc91509b..ba0590f7c 100644 --- a/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java @@ -677,7 +677,9 @@ public class PopupVideoPlayer extends Service { imageLoader.resume(); imageLoader.loadImage(info.thumbnail_url, displayImageOptions, new SimpleImageLoadingListener() { @Override - public void onLoadingComplete(String imageUri, View view, final Bitmap loadedImage) { + public void onLoadingComplete(final String imageUri, View view, final Bitmap loadedImage) { + if (playerImpl == null || playerImpl.getPlayer() == null) return; + if (DEBUG) Log.d(TAG, "FetcherRunnable.imageLoader.onLoadingComplete() called with: imageUri = [" + imageUri + "]"); mainHandler.post(new Runnable() { @Override public void run() {