From 9fbcecf2f5576c4742787a47adbfde500d765c62 Mon Sep 17 00:00:00 2001 From: "Julien \"_FrnchFrgg_\" RIVAUD" Date: Wed, 20 Sep 2017 08:56:44 +0200 Subject: [PATCH] Bail out early if a screen isn't found --- gtk2_ardour/generic_pluginui.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index 979cd4405a..6fe5e8b7fd 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -231,18 +231,18 @@ GenericPluginUI::scroller_size_request (Gtk::Requisition* a) screen = get_screen(); } - int maximum_width = -1; - - if (screen) { - Gdk::Rectangle monitor; - const int monitor_num = screen->get_monitor_at_window (get_window ()); - screen->get_monitor_geometry ( - (monitor_num < 0) ? 0 : monitor_num, - monitor); - - maximum_width = monitor.get_width() * 0.9; + if (!screen) { + return; } + Gdk::Rectangle monitor; + const int monitor_num = screen->get_monitor_at_window (window); + screen->get_monitor_geometry ( + (monitor_num < 0) ? 0 : monitor_num, + monitor); + + const int maximum_width = monitor.get_width() * 0.9; + GtkRequisition request = hpacker.size_request(); if (request.width > maximum_width) {