From 789ea91e1d0835aaf0bf27afdbbba20d8fe5be7c Mon Sep 17 00:00:00 2001 From: Carlos Silva Date: Tue, 21 Jan 2020 10:43:08 -0300 Subject: [PATCH] temporary solution checking if frames exists before extracting the value https://github.com/getsentry/sentry-react-native/issues/742 --- .../main/java/io/sentry/RNSentryModule.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/android/src/main/java/io/sentry/RNSentryModule.java b/android/src/main/java/io/sentry/RNSentryModule.java index 21393ba723..1023bb0b52 100644 --- a/android/src/main/java/io/sentry/RNSentryModule.java +++ b/android/src/main/java/io/sentry/RNSentryModule.java @@ -317,13 +317,17 @@ public void sendEvent(ReadableMap event, Promise promise) { ReadableNativeMap exception = exceptionValues.getMap(0); if (exception.hasKey("stacktrace")) { ReadableNativeMap stacktrace = exception.getMap("stacktrace"); - ReadableNativeArray frames = (ReadableNativeArray)stacktrace.getArray("frames"); - if (exception.hasKey("value")) { - addExceptionInterface(eventBuilder, exception.getString("type"), exception.getString("value"), frames); - } else { - // We use type/type here since this indicates an Unhandled Promise Rejection - // https://github.com/getsentry/react-native-sentry/issues/353 - addExceptionInterface(eventBuilder, exception.getString("type"), exception.getString("type"), frames); + // temporary solution until final fix + // https://github.com/getsentry/sentry-react-native/issues/742 + if (stacktrace.hasKey("frames")) { + ReadableNativeArray frames = (ReadableNativeArray)stacktrace.getArray("frames"); + if (exception.hasKey("value")) { + addExceptionInterface(eventBuilder, exception.getString("type"), exception.getString("value"), frames); + } else { + // We use type/type here since this indicates an Unhandled Promise Rejection + // https://github.com/getsentry/react-native-sentry/issues/353 + addExceptionInterface(eventBuilder, exception.getString("type"), exception.getString("type"), frames); + } } } }