Fix crash when calling quitAndUpdate without any update.
authorCheng Zhao <zcbenz@gmail.com>
Mon, 17 Feb 2014 06:56:23 +0000 (14:56 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 17 Feb 2014 06:56:23 +0000 (14:56 +0800)
browser/api/atom_api_auto_updater.cc

index 69ed10089128d85d0dd6aa4bd458e9040417cb3c..b1fe2915d3318d1060db0d9ecf2db58f36755573 100644 (file)
@@ -80,7 +80,11 @@ void AutoUpdater::CheckForUpdates(
 void AutoUpdater::QuitAndInstall(
     const v8::FunctionCallbackInfo<v8::Value>& args) {
   AutoUpdater* self = AutoUpdater::Unwrap<AutoUpdater>(args.This());
-  self->quit_and_install_.Run();
+
+  if (!self->quit_and_install_.is_null()) {
+    self->quit_and_install_.Run();
+    self->quit_and_install_.Reset();
+  }
 }
 
 // static