From 375e313736c09b0c504c530e5ec95bccc9932f0f Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Thu, 20 Jun 2019 10:24:52 -0700 Subject: [PATCH] Consider callstack as nullable Summary: I received an error like this while rendering: So we should type the callstack accordingly. Reviewed By: priteshrnandgaonkar Differential Revision: D15921517 fbshipit-source-id: 5863c75af142f1c22d5b520db8d7c0283f401e11 --- src/plugins/crash_reporter/index.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/plugins/crash_reporter/index.js b/src/plugins/crash_reporter/index.js index 3f40d2c05..32964e3f2 100644 --- a/src/plugins/crash_reporter/index.js +++ b/src/plugins/crash_reporter/index.js @@ -57,7 +57,7 @@ type CrashSelectorProps = {| export type Crash = {| notificationID: string, - callstack: string, + callstack: ?string, reason: string, name: string, date: Date, @@ -676,15 +676,14 @@ export default class CrashReporterPlugin extends FlipperDevicePlugin< ); const selectedCrashID = crash.notificationID; const onCrashChange = id => { - const newSelectedCrash = crashes.find(element => { - return element.notificationID === id; - }); + const newSelectedCrash = crashes.find( + element => element.notificationID === id, + ); this.setState({crash: newSelectedCrash}); - console.log('onCrashChange called', id); }; - const callstackString = crash.callstack; - const children = crash.callstack.split('\n').map(str => { + const callstackString = crash.callstack || ''; + const children = callstackString.split('\n').map(str => { return {message: str}; }); const crashSelector: CrashSelectorProps = { @@ -699,7 +698,9 @@ export default class CrashReporterPlugin extends FlipperDevicePlugin< { - this.openInLogs(crash.callstack); + if (crash.callstack) { + this.openInLogs(crash.callstack); + } }} /> ) : (