error handling in resolution.c

This commit is contained in:
Linus Dierheimer
2021-02-27 14:46:31 +01:00
parent 48a436ee78
commit 558639086a
+9
View File
@@ -41,15 +41,24 @@ void ffPrintResolution(FFstate* state)
void* x11 = dlopen("libX11.so", RTLD_LAZY);
if(x11 == NULL)
{
ffPrintError(state, "Resolution", "dlopen(\"libX11.so\", RTLD_LAZY) == NULL");
return;
}
Display*(*ffXOpenDisplay)(const char*) = dlsym(x11, "XOpenDisplay");
if(ffXOpenDisplay == NULL)
{
ffPrintError(state, "Resolution", "dlsym(x11, \"XOpenDisplay\") == NULL");
return;
}
Display* display = ffXOpenDisplay(NULL);
if(display == NULL)
{
ffPrintError(state, "Resolution", "ffXOpenDisplay(NULL) == NULL");
return;
}
Screen* screen = DefaultScreenOfDisplay(display);