From cb090dc0887678e387441011945ef24bc9d2608a Mon Sep 17 00:00:00 2001 From: Aleksey Belouosv Date: Thu, 26 Jul 2018 11:47:58 +0300 Subject: [PATCH] [iOS] fix crash on bookmarks category visibility change --- .../Catalog/DownloadedBookmarksViewController.swift | 5 +++-- .../Bookmarks/Categories/BMCView/BMCViewController.swift | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/iphone/Maps/Bookmarks/Catalog/DownloadedBookmarksViewController.swift b/iphone/Maps/Bookmarks/Catalog/DownloadedBookmarksViewController.swift index abf885cbfb..b3096b5333 100644 --- a/iphone/Maps/Bookmarks/Catalog/DownloadedBookmarksViewController.swift +++ b/iphone/Maps/Bookmarks/Catalog/DownloadedBookmarksViewController.swift @@ -69,8 +69,9 @@ class DownloadedBookmarksViewController: MWMViewController { private func setCategoryVisible(_ visible: Bool, at index: Int) { dataSource.setCategory(visible: visible, at: index) - let categoriesHeader = tableView.headerView(forSection: 0) as! BMCCategoriesHeader - categoriesHeader.isShowAll = dataSource.allCategoriesHidden + if let categoriesHeader = tableView.headerView(forSection: 0) as? BMCCategoriesHeader { + categoriesHeader.isShowAll = dataSource.allCategoriesHidden + } } private func shareCategory(at index: Int) { diff --git a/iphone/Maps/Bookmarks/Categories/BMCView/BMCViewController.swift b/iphone/Maps/Bookmarks/Categories/BMCView/BMCViewController.swift index d73812fdad..d0c68f6b2c 100644 --- a/iphone/Maps/Bookmarks/Categories/BMCView/BMCViewController.swift +++ b/iphone/Maps/Bookmarks/Categories/BMCView/BMCViewController.swift @@ -289,8 +289,9 @@ extension BMCViewController: BMCPermissionsCellDelegate { extension BMCViewController: BMCCategoryCellDelegate { func visibilityAction(category: BMCCategory) { viewModel.updateCategoryVisibility(category: category) - let categoriesHeader = tableView.headerView(forSection: viewModel.sectionIndex(section: .categories)) as! BMCCategoriesHeader - categoriesHeader.isShowAll = viewModel.areAllCategoriesHidden() + if let categoriesHeader = tableView.headerView(forSection: viewModel.sectionIndex(section: .categories)) as? BMCCategoriesHeader { + categoriesHeader.isShowAll = viewModel.areAllCategoriesHidden() + } } func moreAction(category: BMCCategory, anchor: UIView) {