From e8594b492eca5231d2ea91e4195df134c7146b1d Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 22 Jan 2014 12:00:34 +0800 Subject: [PATCH] It's safe to send message to nil. --- browser/auto_updater_mac.mm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/browser/auto_updater_mac.mm b/browser/auto_updater_mac.mm index 63747e9..9b69a0a 100644 --- a/browser/auto_updater_mac.mm +++ b/browser/auto_updater_mac.mm @@ -21,8 +21,11 @@ namespace { static SQRLUpdater* g_updater = nil; static void RelaunchToInstallUpdate() { - if (g_updater != nil) - [g_updater relaunchToInstallUpdate]; + [[g_updater relaunchToInstallUpdate] subscribeError:^(NSError* error) { + AutoUpdaterDelegate* delegate = AutoUpdater::GetDelegate(); + if (delegate) + delegate->OnError(base::SysNSStringToUTF8(error.localizedDescription)); + }]; } } // namespace @@ -67,9 +70,7 @@ void AutoUpdater::SetFeedURL(const std::string& feed) { // static void AutoUpdater::CheckForUpdates() { - if (g_updater != nil) { - [g_updater.checkForUpdatesCommand execute:nil]; - } + [g_updater.checkForUpdatesCommand execute:nil]; } } // namespace auto_updater -- 2.7.4