mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-02 17:18:58 +08:00
Fix a crash in RCTAsyncLocalStorage when the value is not a string.
Summary: When you forget to pass the value parameter to AsyncStorage.setItem the entire app would crash instead of showing a useful error message. The problem was that the error function used in the file expected a dictionary but was passed the value of the key which caused the crash. Closes https://github.com/facebook/react-native/pull/535 Github Author: Janic Duplessis <janicduplessis@gmail.com> Test Plan: Imported from GitHub, without a `Test Plan:` line.
This commit is contained in:
@@ -157,7 +157,7 @@ static dispatch_queue_t RCTFileQueue(void)
|
||||
return RCTMakeAndLogError(@"Entries must be arrays of the form [key: string, value: string], got: ", entry, nil);
|
||||
}
|
||||
if (![entry[1] isKindOfClass:[NSString class]]) {
|
||||
return RCTMakeAndLogError(@"Values must be strings, got: ", entry[1], entry[0]);
|
||||
return RCTMakeAndLogError(@"Values must be strings, got: ", entry[1], @{@"key": entry[0]});
|
||||
}
|
||||
NSString *key = entry[0];
|
||||
id errorOut = RCTErrorForKey(key);
|
||||
|
||||
Reference in New Issue
Block a user