Added fail safe

This commit is contained in:
M66B 2022-02-17 12:03:15 +01:00
parent eb90b9914e
commit c56151750b
1 changed files with 9 additions and 5 deletions

View File

@ -92,11 +92,15 @@ public class EditTextCompose extends FixedEditText {
setCustomInsertionActionModeCallback(new ActionMode.Callback() { setCustomInsertionActionModeCallback(new ActionMode.Callback() {
@Override @Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) { public boolean onCreateActionMode(ActionMode mode, Menu menu) {
try {
if (undo_manager && can(android.R.id.undo)) if (undo_manager && can(android.R.id.undo))
menu.add(Menu.CATEGORY_ALTERNATIVE, R.string.title_undo, 1, getTitle(R.string.title_undo)); menu.add(Menu.CATEGORY_ALTERNATIVE, R.string.title_undo, 1, getTitle(R.string.title_undo));
if (undo_manager && can(android.R.id.redo)) if (undo_manager && can(android.R.id.redo))
menu.add(Menu.CATEGORY_ALTERNATIVE, R.string.title_redo, 2, getTitle(R.string.title_redo)); menu.add(Menu.CATEGORY_ALTERNATIVE, R.string.title_redo, 2, getTitle(R.string.title_redo));
menu.add(Menu.CATEGORY_ALTERNATIVE, R.string.title_insert_line, 3, R.string.title_insert_line); menu.add(Menu.CATEGORY_ALTERNATIVE, R.string.title_insert_line, 3, R.string.title_insert_line);
} catch (Throwable ex) {
Log.e(ex);
}
return true; return true;
} }