From 363a8fb08cef8326bba53cd3ea250bde02444126 Mon Sep 17 00:00:00 2001 From: Paige Sun Date: Tue, 3 Aug 2021 16:39:39 -0700 Subject: [PATCH] iOS: Log error when invalid NSNull data is passed to RCTAsyncLocalStorage Summary: Changelog: [Internal] Differential Revision: D30081478 fbshipit-source-id: 7d425e71b020eaeb4eb1b33b500fbf5df7ea9c29 --- React/CoreModules/RCTAsyncLocalStorage.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/React/CoreModules/RCTAsyncLocalStorage.mm b/React/CoreModules/RCTAsyncLocalStorage.mm index 3276d152013..f0fb9081a22 100644 --- a/React/CoreModules/RCTAsyncLocalStorage.mm +++ b/React/CoreModules/RCTAsyncLocalStorage.mm @@ -306,7 +306,11 @@ RCT_EXPORT_MODULE() if (errorOut) { return errorOut; } + if (![entry[1] isKindOfClass:[NSString class]]) { + return RCTMakeAndLogError(@"Invalid value for entry - must be a string. Got entry: ", entry, nil); + } NSString *value = entry[1]; + NSString *filePath = [self _filePathForKey:key]; NSError *error; if (value.length <= RCTInlineValueThreshold) {