Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
3-BodyCoding opened this issue Jun 13, 2017 · 3 comments
Labels
Milestone

Comments

@3-BodyCoding
Copy link

3-BodyCoding commented Jun 13, 2017

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)
@sjudd sjudd added the bug label Jun 15, 2017
@sjudd sjudd added this to the 4.0 milestone Jun 15, 2017
@3-BodyCoding
Copy link
Author

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

@jianwenzhao
Copy link

registry.append modify to registry.replace

@dsuresh-ap
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants