]> khamidou — GitHub mirrors - electron.git/commitdiff
It's safe to send message to nil.
authorCheng Zhao <zcbenz@gmail.com>
Wed, 22 Jan 2014 04:00:34 +0000 (12:00 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 22 Jan 2014 04:00:34 +0000 (12:00 +0800)
browser/auto_updater_mac.mm

index 63747e9f3b52163b2f44fc72b9d65b56f48d6cf0..9b69a0a137fd011a3c768e053d6d10e6b3330e9b 100644 (file)
@@ -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