Skip to content

Commit d4a6aff

Browse files
fix: use try/catch for base class converter error (electron#24450)
* fix: use try/catch for base class converter error * Place try/catch in a block Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
1 parent 73e13ab commit d4a6aff

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

shell/browser/api/electron_api_top_level_window.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,14 @@ TopLevelWindow::TopLevelWindow(v8::Isolate* isolate,
9898
window_->AddObserver(this);
9999

100100
#if defined(TOOLKIT_VIEWS)
101-
// Sets the window icon.
102-
gin::Handle<NativeImage> icon;
103-
if (options.Get(options::kIcon, &icon) && !icon.IsEmpty())
104-
SetIcon(icon);
101+
{
102+
v8::TryCatch try_catch(isolate);
103+
gin::Handle<NativeImage> icon;
104+
if (options.Get(options::kIcon, &icon) && !icon.IsEmpty())
105+
SetIcon(icon);
106+
if (try_catch.HasCaught())
107+
LOG(ERROR) << "Failed to convert NativeImage";
108+
}
105109
#endif
106110
}
107111

0 commit comments

Comments
 (0)