Skip to content

Commit 314ebd8

Browse files
ashishkumar468neslihanturan
authored andcommitted
* Handled Illegal State Exception for non existent appropriate view parents in ViewUtils$showShortSnackbar
1 parent 5fdb6fc commit 314ebd8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

app/src/main/java/fr/free/nrw/commons/utils/ViewUtil.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import android.view.View;
99
import android.view.inputmethod.InputMethodManager;
1010
import android.widget.Toast;
11+
import timber.log.Timber;
1112

1213
public class ViewUtil {
1314

@@ -25,7 +26,13 @@ public static void showShortSnackbar(View view, int messageResourceId) {
2526
return;
2627
}
2728

28-
ExecutorUtils.uiExecutor().execute(() -> Snackbar.make(view, messageResourceId, Snackbar.LENGTH_SHORT).show());
29+
ExecutorUtils.uiExecutor().execute(() -> {
30+
try {
31+
Snackbar.make(view, messageResourceId, Snackbar.LENGTH_SHORT).show();
32+
}catch (IllegalStateException e){
33+
Timber.e(e.getMessage());
34+
}
35+
});
2936
}
3037

3138
public static void showLongToast(Context context, String text) {

0 commit comments

Comments
 (0)