Put null check for attached on setOnClickListener
- Dominant language
- Java
- Stars
- 18.8k
- Forks
- 3.9k
- PR merge metrics
- No merged PRs in 30d
Description
In method `setOnClickListener`, attacher object is accessed without null check.
attacher object is initialized in `init()` method which is called after `super()` constructor is called.
After super() call, ImageView tries to access setOnClickListener which is overriden in PhotoView.
```
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.github.chrisbanes.photoview.PhotoViewAttacher.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
at com.github.chrisbanes.photoview.PhotoView.setOnClickListener(PhotoView.java:90)
at android.view.View.(View.java:5046)
at android.widget.ImageView.(ImageView.java:176)
at android.widget.ImageView.(ImageView.java:171)
at com.github.chrisbanes.photoview.PhotoView.(PhotoView.java:45)
at com.github.chrisbanes.photoview.PhotoView.(PhotoView.java:41)
```
Contributor guide
Assessment
This issue has not been assessed yet.