Skip to content

Commit fcb3cec

Browse files
committed
[Gtk] Catch failure to get get_default_root_window (wayland)
1 parent e8845c2 commit fcb3cec

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

gtk/src/SourceManager.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,11 @@ void SourceManager::takeScreenshot() {
332332
root->get_origin(x, y);
333333
w = root->get_width();
334334
h = root->get_height();
335+
if (w == 0 || h == 0) {
336+
MAIN->getWindow()->deiconify();
337+
Utils::messageBox(Gtk::MESSAGE_ERROR, _("Screenshot Error"), _("Failed to take screenshot."));
338+
return;
339+
}
335340
Glib::RefPtr<Gdk::Pixbuf> pixbuf = Gdk::Pixbuf::create(root, x, y, w, h);
336341
MAIN->getWindow()->deiconify();
337342
if(!pixbuf) {

0 commit comments

Comments
 (0)