-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35222 from pradeepmdk/fix/29743-android-attachmen…
…t-crash1 Android-Attachments-App crashes on uploading specific PDF
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
diff --git a/node_modules/react-native-pdf/index.js b/node_modules/react-native-pdf/index.js | ||
index c05de52..bea7af8 100644 | ||
--- a/node_modules/react-native-pdf/index.js | ||
+++ b/node_modules/react-native-pdf/index.js | ||
@@ -367,11 +367,17 @@ export default class Pdf extends Component { | ||
message[4] = message.splice(4).join('|'); | ||
} | ||
if (message[0] === 'loadComplete') { | ||
+ let tableContents; | ||
+ try { | ||
+ tableContents = message[4]&&JSON.parse(message[4]); | ||
+ } catch(e) { | ||
+ tableContents = message[4]; | ||
+ } | ||
this.props.onLoadComplete && this.props.onLoadComplete(Number(message[1]), this.state.path, { | ||
width: Number(message[2]), | ||
height: Number(message[3]), | ||
}, | ||
- message[4]&&JSON.parse(message[4])); | ||
+ tableContents); | ||
} else if (message[0] === 'pageChanged') { | ||
this.props.onPageChanged && this.props.onPageChanged(Number(message[1]), Number(message[2])); | ||
} else if (message[0] === 'error') { |