]> khamidou — GitHub mirrors - electron.git/commitdiff
throw when trying to create tray before app is ready
authordeepak1556 <hop2deep@gmail.com>
Wed, 25 Mar 2015 14:40:01 +0000 (20:10 +0530)
committerdeepak1556 <hop2deep@gmail.com>
Wed, 25 Mar 2015 14:40:01 +0000 (20:10 +0530)
atom/browser/api/atom_api_tray.cc

index 6315c4059d435ebd3d72951d57e34693915c43b0..94af89b81ecd96401d43482e0dacf93951e95b44 100644 (file)
@@ -7,6 +7,7 @@
 #include <string>
 
 #include "atom/browser/api/atom_api_menu.h"
+#include "atom/browser/browser.h"
 #include "atom/browser/ui/tray_icon.h"
 #include "atom/common/native_mate_converters/image_converter.h"
 #include "atom/common/native_mate_converters/string16_converter.h"
@@ -31,6 +32,10 @@ Tray::~Tray() {
 
 // static
 mate::Wrappable* Tray::New(const gfx::Image& image) {
+  if (!Browser::Get()->is_ready()) {
+    node::ThrowError("Cannot create Tray before app is ready");
+    return nullptr;
+  }
   return new Tray(image);
 }