bumptech / bumptech/glide

NPE in SourceGenerator.onDataReady because of null DiskCacheStrategy

Open
#2,967 6 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
35k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
8

Description

**Glide Version**: 4.6.1

**Integration libraries**: OkHttp3

**Device/Android Version**: Seeing it in many models from Samsung, Huawei, and Xiaomi. In Android L, M, N

**Issue details / Repro steps / Use case background**:

I cannot reproduce this, but have several thousand occurrences in our crash monitoring. It is mainly happening on our list of search results where we have a RecyclerView with many images in it. I haven't been able to isolate any patterns besides that.

**Glide load line / `GlideModule` (if any) / list Adapter code (if any)**:
```java
Glide.with(imageView.context)
.asBitmap()
.load(url) // string
// plus a bunch of logic for request options and nested thumbnails
```

Fairly complicated, but the hierarchy is basically:
- Vertical recyclerView (list of search results)
- FrameLayout
- ConstraintLayout
- FrameLayout (with fixed aspect ratio)
- HorizontalRecyclerView (horizontally swipable images)
- FrameLayout
- ImageView

**Stack trace / LogCat**:
```
java.lang.NullPointerException: Attempt to read from field 'com.bumptech.glide.load.data.DataFetcher com.bumptech.glide.load.model.ModelLoader$LoadData.fetcher' on a null object reference
at com.bumptech.glide.load.engine.SourceGenerator.onDataReady(SourceGenerator.java:106)
at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.onDataReady(MultiModelLoader.java:133)
at com.bumptech.glide.integration.okhttp3.OkHttpStreamFetcher.onResponse(OkHttpStreamFetcher.java:71)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:141)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.