Glide: NullPointerException: Attempt to invoke interface method 'void java.util.List.clear()' on a null object reference

Created on 13 Jun 2017  路  3Comments  路  Source: bumptech/glide


Glide Version: 4.0.0-RC0 and 4.0.0-SNAPSHOT


Integration libraries:okhttp3-integration:4.0.0-RC0 ( 4.0.0-SNAPSHOT)


Device/Android Version:Samsung s7 edge android 7.0


Issue details / Repro steps / Use case background: in recyclerview load imageView.


Glide load line / GlideModule (if any) / list Adapter code (if any):

RequestOptions mCustomOptions = new RequestOptions().placeholder(R.drawable.ic_stub).error(R.drawable.ic_error);
GlideApp.with(context).load(url).apply(mCustomOptions).into(imageView);

context is a Fragment.

@GlideModule
public final class PthAppGlideModule extends AppGlideModule
{
    @Override
    public void registerComponents(Context context, Registry registry)
    {
        registry.append(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(OkHttp3Utils.getOkHttpClientInstance(context)));
    }

    @Override
    public boolean isManifestParsingEnabled()
    {
        return false;
    }
}


Layout XML:

   <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

    <ImageView
            android:id="@+id/item_iv"
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:scaleType="centerCrop" />
  </LinearLayout>


Stack trace / LogCat:

 Request threw uncaught throwable
                                                          java.lang.NullPointerException: Attempt to invoke interface method 'void java.util.List.clear()' on a null object reference
                                                              at com.bumptech.glide.util.pool.FactoryPools$3.reset(FactoryPools.java:86)
                                                              at com.bumptech.glide.util.pool.FactoryPools$3.reset(FactoryPools.java:83)
                                                              at com.bumptech.glide.util.pool.FactoryPools$FactoryPool.release(FactoryPools.java:162)
                                                              at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.cleanup(MultiModelLoader.java:98)
                                                              at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.cleanup(MultiModelLoader.java:101)
                                                              at com.bumptech.glide.load.engine.SourceGenerator.cacheData(SourceGenerator.java:87)
                                                              at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:45)
                                                              at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:275)
                                                              at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:245)
                                                              at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:220)
                                                              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                                                              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                              at java.lang.Thread.run(Thread.java:818)
                                                              at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:347)
bug

Most helpful comment

registry.append modify to registry.replace

All 3 comments

The first time to load a new picture URL will appear this BUG, the second time after the normal.

registry.append modify to registry.replace

@jianwenzhao Thanks, that seemed to work for me in the time being

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Anton111111 picture Anton111111  路  3Comments

FooBarBacon picture FooBarBacon  路  3Comments

Ncit picture Ncit  路  3Comments

mttmllns picture mttmllns  路  3Comments

technoir42 picture technoir42  路  3Comments