File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -524,13 +524,25 @@ static bool X11_MessageBoxCreateWindow(SDL_MessageBoxDataX11 *data)
524
524
#ifdef SDL_VIDEO_DRIVER_X11_XRANDR
525
525
else if (SDL_GetHintBoolean (SDL_HINT_VIDEO_X11_XRANDR , use_xrandr_by_default ) && data -> xrandr ) {
526
526
XRRScreenResources * screen = X11_XRRGetScreenResourcesCurrent (display , DefaultRootWindow (display ));
527
+ if (!screen ) {
528
+ goto XRANDRBAIL ;
529
+ }
530
+ if (!screen -> ncrtc ) {
531
+ goto XRANDRBAIL ;
532
+ }
533
+
527
534
XRRCrtcInfo * crtc_info = X11_XRRGetCrtcInfo (display , screen , screen -> crtcs [0 ]);
528
- x = (crtc_info -> width - data -> dialog_width ) / 2 ;
529
- y = (crtc_info -> height - data -> dialog_height ) / 3 ;
535
+ if (crtc_info ) {
536
+ x = (crtc_info -> width - data -> dialog_width ) / 2 ;
537
+ y = (crtc_info -> height - data -> dialog_height ) / 3 ;
538
+ } else {
539
+ goto XRANDRBAIL ;
540
+ }
530
541
}
531
542
#endif
532
543
else {
533
544
// oh well. This will misposition on a multi-head setup. Init first next time.
545
+ XRANDRBAIL :
534
546
x = (DisplayWidth (display , data -> screen ) - data -> dialog_width ) / 2 ;
535
547
y = (DisplayHeight (display , data -> screen ) - data -> dialog_height ) / 3 ;
536
548
}
You can’t perform that action at this time.
0 commit comments