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 in RequestManagerRetriever.findAllSupportFragmentsWithViews #1991

Closed
tetsukay opened this issue Jun 1, 2017 · 1 comment
Labels
Milestone

Comments

@tetsukay
Copy link

tetsukay commented Jun 1, 2017

sorry, I am not good at English.

Glide Version: 4.0.0 RC0

Integration libraries: okhttp3-integration 4.0.0 RC0

Device/Android Version: Android 5.1

Issue details / Repro steps / Use case background:
NullPointerException in RequestManagerRetriever.findAllSupportFragmentsWithViews() in Glide.with(View)

in findAllSupportFragmentsWithViews() , topLevelFragments Collection is not null and not empty too.
but, topLevelFragments have null, so NullPointerException in for-each.

I received crash reporting, but I could not reproduction.
I think that will occur when called Glide.with after view is destroyed.
But, I tried block after onDetachedFromWindow, It did not improve.

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

public void setImageUrl(@NonNull String url) {
  Glide.with(this).load(url).into(this); // "this" is ImageView instance
}
public void setImageUrl(@NonNull String url) {
  if (!isViewDestroyed) { // "true" after called onDetachedFromWindow
    Glide.with(this).load(url).into(this); // "this" is ImageView instance
  }
}

NPE occurred too.

Stack trace / LogCat:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.support.v4.app.Fragment.getView()' on a null object reference
       at com.bumptech.glide.manager.RequestManagerRetriever.findAllSupportFragmentsWithViews(RequestManagerRetriever.java:189)
       at com.bumptech.glide.manager.RequestManagerRetriever.findSupportFragment(RequestManagerRetriever.java:200)
       at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:167)
       at com.bumptech.glide.Glide.with(Glide.java:609)
       at com.example.views.ExImageView.setImageUrl(ExImageView.java:55)
       at ...

RequestManagerRetriever.java#189 fragment is null

Is it bug of glide? or Is my usage wrong?

@sjudd sjudd added the bug label Jun 2, 2017
@sjudd sjudd added this to the 4.0 milestone Jun 2, 2017
@sjudd
Copy link
Collaborator

sjudd commented Jun 2, 2017

Looks like a bug in Glide. Great report, thanks!

@sjudd sjudd closed this as completed in db2e6bb Jun 2, 2017
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

2 participants