Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,14 @@ public class ReactModalHostView(context: ThemedReactContext) :
}
val dialogContext =
ContextUtils.findContextOfType(nonNullDialog.context, Activity::class.java)
if (dialogContext == null || !dialogContext.isFinishing) {
nonNullDialog.dismiss()
// A destroyed Activity (e.g. relaunched on a configuration change without finishing) has
// already removed the dialog's window, so dismissing it would throw.
if (dialogContext == null || !(dialogContext.isFinishing || dialogContext.isDestroyed)) {
try {
nonNullDialog.dismiss()
} catch (e: IllegalArgumentException) {
FLog.e(TAG, "ReactModalHostView: error while dismissing dialog: ", e.message)
}
}
}
dialog = null
Expand Down
Loading