Skip to content

Commit

Permalink
Fix a crash in RCTAsyncLocalStorage when the value is not a string.
Browse files Browse the repository at this point in the history
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 facebook#535
Github Author: Janic Duplessis <janicduplessis@gmail.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
  • Loading branch information
janicduplessis committed Mar 31, 2015
1 parent b003e0a commit f8a08df
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion React/Modules/RCTAsyncLocalStorage.m
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ - (id)_writeEntry:(NSArray *)entry
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);
Expand Down

0 comments on commit f8a08df

Please sign in to comment.