         }
         searchBar.apply(theme: theme)
         searchBarContainerView.backgroundColor = theme.colors.paperBackground
-        searchLanguageBarViewController.apply(theme: theme)
+        searchLanguageBarViewController?.apply(theme: theme)
         resultsViewController.apply(theme: theme)
         view.backgroundColor = .clear
         collectionView.backgroundColor = theme.colors.paperBackground

    }
    
    var siteURL: URL? {
        return searchLanguageBarViewController.currentlySelectedSearchLanguage?.siteURL() ?? NSURL.wmf_URLWithDefaultSiteAndCurrentLocale()
    }
    
    @objc func search() {

        }
    }
    
    private func setupLanguageBarViewController() -> SearchLanguagesBarViewController {
        if let vc = self.searchLanguageBarViewController {
            return vc
        }
        let searchLanguageBarViewController = SearchLanguagesBarViewController()
        searchLanguageBarViewController.apply(theme: theme)
        self.searchLanguageBarViewController = searchLanguageBarViewController
        return searchLanguageBarViewController
    }
    
    private func updateLanguageBarVisibility() {
        if UserDefaults.wmf_userDefaults().wmf_showSearchLanguageBar() { // check this before accessing the view
            let searchLanguageBarViewController = setupLanguageBarViewController()
            addChildViewController(searchLanguageBarViewController)
            searchLanguageBarViewController.view.translatesAutoresizingMaskIntoConstraints = false
            navigationBar.addExtendedNavigationBarView(searchLanguageBarViewController.view)
            searchLanguageBarViewController.didMove(toParentViewController: self)
            searchLanguageBarViewController.view.isHidden = false
        } else {
            searchLanguageBarViewController?.willMove(toParentViewController: nil)
            navigationBar.removeExtendedNavigationBarView()
            searchLanguageBarViewController?.removeFromParentViewController()
            searchLanguageBarViewController = nil
        }
    }

