From 85e94208167f240eccfd3e0c8e51acc4264c3e47 Mon Sep 17 00:00:00 2001 From: fractalwrench Date: Mon, 10 May 2021 11:59:20 +0100 Subject: [PATCH] fix: prevent rare NPE in log message --- CHANGELOG.md | 7 +++++-- .../src/main/java/com/bugsnag/android/ndk/NativeBridge.kt | 4 +--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06a12d3e3e..49e023c75e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,11 @@ ### Bug fixes - * Fix bug that terminated the app when multiple ANRs occur - [#1235](https://github.com/bugsnag/bugsnag-android/pull/1235) +* Fix bug that terminated the app when multiple ANRs occur + [#1235](https://github.com/bugsnag/bugsnag-android/pull/1235) + +* Prevent rare NPE in log message + [#1238](https://github.com/bugsnag/bugsnag-android/pull/1238) * Prevent rare NPE when capturing thread traces [#1237](https://github.com/bugsnag/bugsnag-android/pull/1237) diff --git a/bugsnag-plugin-android-ndk/src/main/java/com/bugsnag/android/ndk/NativeBridge.kt b/bugsnag-plugin-android-ndk/src/main/java/com/bugsnag/android/ndk/NativeBridge.kt index 15ecda66d2..7b66d68eb9 100644 --- a/bugsnag-plugin-android-ndk/src/main/java/com/bugsnag/android/ndk/NativeBridge.kt +++ b/bugsnag-plugin-android-ndk/src/main/java/com/bugsnag/android/ndk/NativeBridge.kt @@ -138,15 +138,13 @@ class NativeBridge : Observer { } private fun isInvalidMessage(msg: Any?): Boolean { - if (msg !is StateEvent) { + if (msg == null || msg !is StateEvent) { return true } if (!installed.get() && msg !is Install) { logger.w("Received message before INSTALL: $msg") return true } - - logger.d(String.format("Received NDK message %s", msg)) return false }