Prevent NPE b/c of race condition
This commit is contained in:
parent
5f1c78b4f4
commit
5f0ddbc15d
|
@ -177,13 +177,16 @@ public class AllEpisodesListAdapter extends BaseAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadFailed(Exception e, Drawable errorDrawable) {
|
public void onLoadFailed(Exception e, Drawable errorDrawable) {
|
||||||
if(fallback.get() != null && placeholder.get() != null && cover.get() != null) {
|
Uri fallbackUri = fallback.get();
|
||||||
|
TextView txtvPlaceholder = placeholder.get();
|
||||||
|
ImageView imgvCover = cover.get();
|
||||||
|
if(fallbackUri != null && txtvPlaceholder != null && imgvCover != null) {
|
||||||
Glide.with(context)
|
Glide.with(context)
|
||||||
.load(fallback.get())
|
.load(fallbackUri)
|
||||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||||
.fitCenter()
|
.fitCenter()
|
||||||
.dontAnimate()
|
.dontAnimate()
|
||||||
.into(new CoverTarget(null, placeholder.get(), cover.get()));
|
.into(new CoverTarget(null, txtvPlaceholder, imgvCover));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -182,13 +182,16 @@ public class QueueListAdapter extends BaseAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadFailed(Exception e, Drawable errorDrawable) {
|
public void onLoadFailed(Exception e, Drawable errorDrawable) {
|
||||||
if(fallback.get() != null && placeholder.get() != null && cover.get() != null) {
|
Uri fallbackUri = fallback.get();
|
||||||
|
TextView txtvPlaceholder = placeholder.get();
|
||||||
|
ImageView imgvCover = cover.get();
|
||||||
|
if(fallbackUri != null && txtvPlaceholder != null && imgvCover != null) {
|
||||||
Glide.with(context)
|
Glide.with(context)
|
||||||
.load(fallback.get())
|
.load(fallbackUri)
|
||||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||||
.fitCenter()
|
.fitCenter()
|
||||||
.dontAnimate()
|
.dontAnimate()
|
||||||
.into(new CoverTarget(null, placeholder.get(), cover.get()));
|
.into(new CoverTarget(null, txtvPlaceholder, imgvCover));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue