aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/QuickMedia.cpp14
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);