From 9196510ed83bbe6267371c2f3d969ee26ca27fe5 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Fri, 14 Jul 2023 10:44:52 -0700 Subject: [PATCH] More fixes for the new clang-tidy roll on iOS targets (flutter/engine#43688) See https://github.com/flutter/engine/pull/43661 --- .../darwin/ios/framework/Source/FlutterAppDelegate.mm | 2 +- .../platform/darwin/ios/framework/Source/FlutterEngine.mm | 2 +- .../darwin/ios/framework/Source/accessibility_bridge.mm | 3 ++- .../flutter/shell/platform/darwin/ios/platform_view_ios.mm | 7 +++++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm index 741a0bf626..9b572e9de0 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm @@ -153,7 +153,7 @@ static NSString* const kRestorationStateAppModificationKey = @"mod-date"; [flutterViewController.engine.navigationChannel invokeMethod:@"pushRouteInformation" arguments:@{ - @"location" : url.absoluteString, + @"location" : url.absoluteString ?: [NSNull null], }]; } }]; diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm index 8f67ec1b8b..e69b9157b7 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm @@ -683,7 +683,7 @@ static constexpr int kNumProfilerSamplesPerSec = 5; NSString* format = [NSString stringWithUTF8String:screenshot.format.c_str()]; NSNumber* width = @(screenshot.frame_size.fWidth); NSNumber* height = @(screenshot.frame_size.fHeight); - return result(@[ width, height, format, data ]); + return result(@[ width, height, format ?: [NSNull null], data ]); }]; } diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm index 2121a2ac69..bf19109e92 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm @@ -161,7 +161,8 @@ void AccessibilityBridge::UpdateSemantics( if (root) { if (!view_controller_.view.accessibilityElements) { - view_controller_.view.accessibilityElements = @[ [root accessibilityContainer] ]; + view_controller_.view.accessibilityElements = + @[ [root accessibilityContainer] ?: [NSNull null] ]; } NSMutableArray* newRoutes = [[[NSMutableArray alloc] init] autorelease]; [root collectRoutes:newRoutes]; diff --git a/engine/src/flutter/shell/platform/darwin/ios/platform_view_ios.mm b/engine/src/flutter/shell/platform/darwin/ios/platform_view_ios.mm index f600f6c083..66636fe084 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/platform_view_ios.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/platform_view_ios.mm @@ -223,9 +223,12 @@ std::unique_ptr> PlatformViewIOS::ComputePlatformResolv [NSMutableArray arrayWithCapacity:supported_locale_data.size() / localeDataLength]; for (size_t i = 0; i < supported_locale_data.size(); i += localeDataLength) { NSDictionary* dict = @{ - NSLocaleLanguageCode : [NSString stringWithUTF8String:supported_locale_data[i].c_str()], - NSLocaleCountryCode : [NSString stringWithUTF8String:supported_locale_data[i + 1].c_str()], + NSLocaleLanguageCode : [NSString stringWithUTF8String:supported_locale_data[i].c_str()] + ?: @"", + NSLocaleCountryCode : [NSString stringWithUTF8String:supported_locale_data[i + 1].c_str()] + ?: @"", NSLocaleScriptCode : [NSString stringWithUTF8String:supported_locale_data[i + 2].c_str()] + ?: @"" }; [supported_locale_identifiers addObject:[NSLocale localeIdentifierFromComponents:dict]]; }