Handled null CompoundDrawable[2] in etTitle-> UploadMediaDetailsFragment (#3828)

This commit is contained in:
Ashish Kumar 2020-06-23 19:35:18 +05:30 committed by GitHub
parent 3e389be6f5
commit 78d519f83e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -176,11 +176,13 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements
etTitle.setOnTouchListener((v, event) -> { etTitle.setOnTouchListener((v, event) -> {
//2 is for drawable right //2 is for drawable right
float twelveDpInPixels = convertDpToPixel(12, getContext()); float twelveDpInPixels = convertDpToPixel(12, getContext());
if (event.getAction() == MotionEvent.ACTION_UP && etTitle.getCompoundDrawables() != null if ((event.getAction() == MotionEvent.ACTION_UP)
&& etTitle.getCompoundDrawables().length > 2 && etTitle && (etTitle.getCompoundDrawables() != null)
.getCompoundDrawables()[2].getBounds() && (etTitle.getCompoundDrawables().length > 2)
.contains((int) (etTitle.getWidth() - (event.getX() + twelveDpInPixels)), && (etTitle.getCompoundDrawables()[2] != null)
(int) (event.getY() - twelveDpInPixels))) { && etTitle.getCompoundDrawables()[2].getBounds()
.contains((int) (etTitle.getWidth() - (event.getX() + twelveDpInPixels)),
(int) (event.getY() - twelveDpInPixels))) {
showInfoAlert(R.string.media_detail_title, R.string.title_info); showInfoAlert(R.string.media_detail_title, R.string.title_info);
return true; return true;
} }