diff --git a/ios/chrome/browser/find_in_page/js_findinpage_manager.mm b/ios/chrome/browser/find_in_page/js_findinpage_manager.mm index 937922144792b..37047b5526c08 100644 --- a/ios/chrome/browser/find_in_page/js_findinpage_manager.mm +++ b/ios/chrome/browser/find_in_page/js_findinpage_manager.mm @@ -169,11 +169,12 @@ - (void)disableWithCompletionHandler:(ProceduralBlock)completionHandler { #pragma mark FindInPageEntry - (BOOL)processFindInPageResult:(id)result scrollPosition:(CGPoint*)point { - if (!result) + NSString* result_str = base::mac::ObjCCastStrict(result); + if (!result_str) return NO; // Parse JSONs. - std::string json = base::SysNSStringToUTF8(result); + std::string json = base::SysNSStringToUTF8(result_str); std::unique_ptr root(base::JSONReader::Read(json, false)); if (!root.get()) return YES;