From: deepak1556 Date: Wed, 25 Mar 2015 14:40:01 +0000 (+0530) Subject: throw when trying to create tray before app is ready X-Git-Tag: v0.22.3~28^2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=e87041bcfcc9cf3c9ffe8caef5d82d8b6b09d505;p=electron.git throw when trying to create tray before app is ready --- diff --git a/atom/browser/api/atom_api_tray.cc b/atom/browser/api/atom_api_tray.cc index 6315c405..94af89b8 100644 --- a/atom/browser/api/atom_api_tray.cc +++ b/atom/browser/api/atom_api_tray.cc @@ -7,6 +7,7 @@ #include #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); }