From 4f8c94a1175d6b388037c14f8fbc992146d6e6e9 Mon Sep 17 00:00:00 2001 From: shreyasv Date: Fri, 26 Jun 2015 15:59:46 -0700 Subject: Correcting a DCHECK. The previous DCHECK was wrong since it was checking for |result|. The base::JSONReader::Read API can return a nullptr base::Value. Also moved the DCHECK outside the check for |handler| since it should be verified even when no |handler| is registered. BUG=503598 Review URL: https://codereview.chromium.org/1212393004 Cr-Commit-Position: refs/heads/master@{#336469} --- ios/web/web_state/ui/crw_web_controller.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ios') diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm index 7007edf..f1ad838 100644 --- a/ios/web/web_state/ui/crw_web_controller.mm +++ b/ios/web/web_state/ui/crw_web_controller.mm @@ -1863,10 +1863,10 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; (void (^)(scoped_ptr, NSError*))handler { [self evaluateJavaScript:script stringResultHandler:^(NSString* stringResult, NSError* error) { + DCHECK(stringResult || error); if (handler) { scoped_ptr result( base::JSONReader::Read(base::SysNSStringToUTF8(stringResult))); - DCHECK(result || error); handler(result.Pass(), error); } }]; -- cgit v1.1