mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix NPE in FileReaderModule (#45287)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/45287 Fixes https://github.com/facebook/react-native/issues/45277 This fixes an NPE reported in OSS if you do this call in JavaScript: ``` const fr = new FileReader(); fr.readAsText({}); ``` Changelog: [Android] [Fixed] - Fix NPE in FileReaderModule Reviewed By: dmytrorykun Differential Revision: D59372620 fbshipit-source-id: ad5073376eaa26852c8277bdbb7d76b1aa480b3c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
06fc6f2beb
commit
fd4531fe23
+6
@@ -41,6 +41,9 @@ public class FileReaderModule extends NativeFileReaderModuleSpec {
|
||||
promise.reject(
|
||||
new IllegalStateException("Could not get BlobModule from ReactApplicationContext"));
|
||||
return;
|
||||
} else if (blob == null) {
|
||||
promise.reject(ERROR_INVALID_BLOB, "The specified blob is null");
|
||||
return;
|
||||
}
|
||||
|
||||
byte[] bytes =
|
||||
@@ -66,6 +69,9 @@ public class FileReaderModule extends NativeFileReaderModuleSpec {
|
||||
promise.reject(
|
||||
new IllegalStateException("Could not get BlobModule from ReactApplicationContext"));
|
||||
return;
|
||||
} else if (blob == null) {
|
||||
promise.reject(ERROR_INVALID_BLOB, "The specified blob is null");
|
||||
return;
|
||||
}
|
||||
|
||||
byte[] bytes =
|
||||
|
||||
Reference in New Issue
Block a user