diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-03-02 00:31:19 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-03-02 00:31:19 +0100 |
commit | d3091854805fc625e2f6109f6f4af579420cd2a5 (patch) | |
tree | 2de1da64e258f1fd5b1c9ff9f73b8e90bcb0fca6 /src | |
parent | deed9799f5a8edc49d9747cfef3394999b59b54f (diff) |
Fix crash with certain monitor setups #2
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index dd5b025..6b480d2 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -109,13 +109,15 @@ static int get_largest_monitor_height(Display *display) { XRROutputInfo *out_info = XRRGetOutputInfo(display, screen_res, screen_res->outputs[i]); if(out_info && out_info->connection == RR_Connected) { XRRCrtcInfo* crt_info = XRRGetCrtcInfo(display, screen_res, out_info->crtc); - const XRRModeInfo *mode_info = get_mode_info(screen_res, crt_info->mode); - if(mode_info) { - // Need to get the min of width or height because we want to get the smallest size for monitors in portrait mode, for mobile devices such as pinephone - int width_or_height = std::min((int)mode_info->width, (int)mode_info->height); - max_height = std::max(max_height, width_or_height); + if(crt_info) { + const XRRModeInfo *mode_info = get_mode_info(screen_res, crt_info->mode); + if(mode_info) { + // Need to get the min of width or height because we want to get the smallest size for monitors in portrait mode, for mobile devices such as pinephone + int width_or_height = std::min((int)mode_info->width, (int)mode_info->height); + max_height = std::max(max_height, width_or_height); + } + XRRFreeCrtcInfo(crt_info); } - XRRFreeCrtcInfo(crt_info); } if(out_info) XRRFreeOutputInfo(out_info); |