xfreerdp: fix crash with /monitor-list
Catch the case when /monitor-list was used but the X display couldn't be opened or wasn't available.
This commit is contained in:
parent
5046b1d035
commit
5d4de15401
@ -50,6 +50,11 @@ int xf_list_monitors(xfContext* xfc)
|
||||
XineramaScreenInfo* screen = NULL;
|
||||
|
||||
display = XOpenDisplay(NULL);
|
||||
if (!display)
|
||||
{
|
||||
WLog_ERR(TAG, "failed to open X display");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (XineramaQueryExtension(display, &ignored, &ignored2))
|
||||
{
|
||||
@ -76,6 +81,11 @@ int xf_list_monitors(xfContext* xfc)
|
||||
|
||||
display = XOpenDisplay(NULL);
|
||||
|
||||
if(!display)
|
||||
{
|
||||
WLog_ERR(TAG, "failed to open X display");
|
||||
return -1;
|
||||
}
|
||||
screen = ScreenOfDisplay(display, DefaultScreen(display));
|
||||
WLog_DBG(TAG, " * [0] %dx%d\t+%d+%d", WidthOfScreen(screen), HeightOfScreen(screen), 0, 0);
|
||||
XCloseDisplay(display);
|
||||
|
Loading…
x
Reference in New Issue
Block a user