From e87041bcfcc9cf3c9ffe8caef5d82d8b6b09d505 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Wed, 25 Mar 2015 20:10:01 +0530 Subject: [PATCH] throw when trying to create tray before app is ready --- atom/browser/api/atom_api_tray.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/atom/browser/api/atom_api_tray.cc b/atom/browser/api/atom_api_tray.cc index 6315c4059d..94af89b81e 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); }