diff options
Diffstat (limited to 'java/org/gnu/emacs/EmacsDialog.java')
| -rw-r--r-- | java/org/gnu/emacs/EmacsDialog.java | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/java/org/gnu/emacs/EmacsDialog.java b/java/org/gnu/emacs/EmacsDialog.java index 7d88a23c58f..bd5e9ba8ee7 100644 --- a/java/org/gnu/emacs/EmacsDialog.java +++ b/java/org/gnu/emacs/EmacsDialog.java @@ -230,11 +230,31 @@ public class EmacsDialog implements DialogInterface.OnDismissListener AlertDialog dialog; if (EmacsActivity.focusedActivities.isEmpty ()) - return false; + { + /* If focusedActivities is empty then this dialog may have + been displayed immediately after a popup dialog is + dismissed. */ + + activity = EmacsActivity.lastFocusedActivity; + + if (activity == null) + return false; + } + else + activity = EmacsActivity.focusedActivities.get (0); - activity = EmacsActivity.focusedActivities.get (0); dialog = dismissDialog = toAlertDialog (activity); - dismissDialog.show (); + + try + { + dismissDialog.show (); + } + catch (Exception exception) + { + /* This can happen when the system decides Emacs is not in the + foreground any longer. */ + return false; + } /* If there are less than four buttons, then they must be individually enabled or disabled after the dialog is |
