From 142e891e160e00dc0f98e79d3d3a532938544f26 Mon Sep 17 00:00:00 2001 From: Alexander Borsuk Date: Sun, 4 Sep 2022 00:06:04 +0300 Subject: [PATCH] [ios] Fixed assert when controller is there but in a wrong order Reproduced by opening Downloader and zooming to any downloaded country. Signed-off-by: Alexander Borsuk --- iphone/Maps/Classes/MapsAppDelegate.mm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index 90ed80d42e..e19490f3dd 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -333,10 +333,10 @@ using namespace osm_auth_ios; #pragma mark - Properties - (MapViewController *)mapViewController { - auto obj = [(UINavigationController *)self.window.rootViewController viewControllers].firstObject; - if ([obj isKindOfClass:[MapViewController class]]) - return obj; - + for (id vc in [(UINavigationController *)self.window.rootViewController viewControllers]) { + if ([vc isKindOfClass:[MapViewController class]]) + return vc; + } NSAssert(false, @"Please check the logic"); return nil; }