Add further checks to avoid null pointer.

This commit is contained in:
ManoloFLTK 2019-03-27 12:33:00 +01:00
parent a6ea844879
commit b488b2c9d0

View File

@ -383,8 +383,11 @@ void Fl_Screen_Driver::transient_scale_display(float f, int nscreen)
win_and_widget *data = new win_and_widget;
data->win = win;
data->widget = Fl::focus();
if (data->widget && data->widget->top_window()->user_data() == &transient_scale_display) {
data->widget = 0;
if (data->widget) {
Fl_Window *top = data->widget->top_window();
if (!top || top->user_data() == &transient_scale_display) {
data->widget = 0;
}
}
win->show();
Fl::add_timeout(1, (Fl_Timeout_Handler)del_transient_window, data); // delete after 1 sec