Bail out early if a screen isn't found

This commit is contained in:
Julien "_FrnchFrgg_" RIVAUD 2017-09-20 08:56:44 +02:00
parent 7d559de3d0
commit 9fbcecf2f5
1 changed files with 10 additions and 10 deletions

View File

@ -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) {