Skip to content

Commit 78d519f

Browse files
Handled null CompoundDrawable[2] in etTitle-> UploadMediaDetailsFragment (#3828)
1 parent 3e389be commit 78d519f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

app/src/main/java/fr/free/nrw/commons/upload/mediaDetails/UploadMediaDetailFragment.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,13 @@ private void addEtTitleTouchListener() {
176176
etTitle.setOnTouchListener((v, event) -> {
177177
//2 is for drawable right
178178
float twelveDpInPixels = convertDpToPixel(12, getContext());
179-
if (event.getAction() == MotionEvent.ACTION_UP && etTitle.getCompoundDrawables() != null
180-
&& etTitle.getCompoundDrawables().length > 2 && etTitle
181-
.getCompoundDrawables()[2].getBounds()
182-
.contains((int) (etTitle.getWidth() - (event.getX() + twelveDpInPixels)),
183-
(int) (event.getY() - twelveDpInPixels))) {
179+
if ((event.getAction() == MotionEvent.ACTION_UP)
180+
&& (etTitle.getCompoundDrawables() != null)
181+
&& (etTitle.getCompoundDrawables().length > 2)
182+
&& (etTitle.getCompoundDrawables()[2] != null)
183+
&& etTitle.getCompoundDrawables()[2].getBounds()
184+
.contains((int) (etTitle.getWidth() - (event.getX() + twelveDpInPixels)),
185+
(int) (event.getY() - twelveDpInPixels))) {
184186
showInfoAlert(R.string.media_detail_title, R.string.title_info);
185187
return true;
186188
}

0 commit comments

Comments
 (0)