From 4c09d12a91a0de11a1aef96e4cf235735681ccab Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 19 May 2016 23:52:27 +0200 Subject: [PATCH] Don't crash in wxDisplay::GetCurrentMode() if there is no support Display sample crashed on startup if XFree86-VidModeExtension extension was not available. Add missing error checking to avoid this. --- src/unix/displayx11.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/unix/displayx11.cpp b/src/unix/displayx11.cpp index 0310f2c272..5b709ca0ff 100644 --- a/src/unix/displayx11.cpp +++ b/src/unix/displayx11.cpp @@ -219,7 +219,9 @@ wxVideoMode wxXF86VidMode_GetCurrentMode(Display* display, int nScreen) { XF86VidModeModeLine VM; int nDotClock; - XF86VidModeGetModeLine(display, nScreen, &nDotClock, &VM); + if ( !XF86VidModeGetModeLine(display, nScreen, &nDotClock, &VM) ) + return wxVideoMode(); + wxClearXVM(VM); return wxCVM2(VM, nDotClock, display, nScreen); }