Skip to content

Commit da0eefa

Browse files
authored
Fixed exception propagation on null default uncaught exception handler (#6280)
Fixed exception propagation in the case of no default uncaught exception handler. Exit code 1 is what the default java uncaught exception handler exits with.
1 parent 2365b9b commit da0eefa

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

firebase-crashlytics/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Unreleased
22
* [fixed] Improved data consistency for rapid user actions.
3+
* [fixed] Fixed exception propagation in the case of no default uncaught exception handler.
34
* [changed] Internal changes to improve startup time.
45
* [changed] Internal changes to the way background tasks are scheduled.
56
* [changed] Migrated SDK to use standard Firebase executors.

firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/common/CrashlyticsUncaughtExceptionHandler.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,13 @@ public void uncaughtException(Thread thread, Throwable ex) {
5858
} catch (Exception e) {
5959
Logger.getLogger().e("An error occurred in the uncaught exception handler", e);
6060
} finally {
61-
Logger.getLogger().d("Completed exception processing. Invoking default exception handler.");
62-
defaultHandler.uncaughtException(thread, ex);
61+
if (defaultHandler != null) {
62+
Logger.getLogger().d("Completed exception processing. Invoking default exception handler.");
63+
defaultHandler.uncaughtException(thread, ex);
64+
} else {
65+
Logger.getLogger().d("Completed exception processing, but no default exception handler.");
66+
System.exit(1);
67+
}
6368
isHandlingException.set(false);
6469
}
6570
}

0 commit comments

Comments
 (0)