     // At startup, the extension may show an alert that it can't share. In this case for a better UI, rather than showing
     // 2 popup dialogs (the main one and then the alert), just show the alert.
     func hidePopupWhenShowingAlert() {
-        embedController.navigationController.view.alpha = 0
+        embedController?.navigationController.view.alpha = 0
     }
 }
 


@objc(InitialViewController)
class InitialViewController: UIViewController {
    var embedController: EmbeddedNavController!
    var shareViewController: ShareViewController!

    override func viewDidLoad() {
        UIDevice.current.beginGeneratingDeviceOrientationNotifications()

            }

            // This is the view controller for the popup dialog
            let shareController = ShareViewController()
            shareController.delegate = self
            shareController.shareItem = shareItem
            self.shareViewController = shareController

            self.embedController = EmbeddedNavController(isSearchMode: !shareItem.isUrlType(), parent: self, rootViewController: shareController)
        }
    }

