diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.cxx b/src/drivers/X11/Fl_X11_Screen_Driver.cxx index 660ed03b0..1afbebacd 100644 --- a/src/drivers/X11/Fl_X11_Screen_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Screen_Driver.cxx @@ -1223,8 +1223,8 @@ static bool usemonitors_xml(float &factor, int width, int height) { } if ( in_config && (p = strstr(line, "")) && strstr(p, "") ) { sscanf(p + 7, "%d", &w); - fgets(line, sizeof(line), in); - p = strstr(line, ""); + p = fgets(line, sizeof(line), in); + if (p) p = strstr(line, ""); if (p) sscanf(p+8, "%d", &h); if (p && w == width && h == height) { found = true;