From 8d7b6d9a992249c8286a84fbdd4e2aeb0db983ac Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Tue, 31 Mar 2015 14:46:15 -0700 Subject: [PATCH] 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 Test Plan: Imported from GitHub, without a `Test Plan:` line. --- React/Modules/RCTAsyncLocalStorage.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/React/Modules/RCTAsyncLocalStorage.m b/React/Modules/RCTAsyncLocalStorage.m index e1daeb2fb83..95fb383e484 100644 --- a/React/Modules/RCTAsyncLocalStorage.m +++ b/React/Modules/RCTAsyncLocalStorage.m @@ -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);