Fixed bug when a X display connection cannot be established

This commit is contained in:
Elias Naur 2003-02-20 13:20:54 +00:00
parent 24ac909558
commit 6113da5083
1 changed files with 4 additions and 1 deletions

View File

@ -443,7 +443,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_Display_getAvailableDisplayModes
int num_modes, i; int num_modes, i;
Display *disp = XOpenDisplay(NULL); Display *disp = XOpenDisplay(NULL);
int screen = DefaultScreen(disp); int screen;
XF86VidModeModeInfo **avail_modes; XF86VidModeModeInfo **avail_modes;
if (disp == NULL) { if (disp == NULL) {
@ -453,6 +453,9 @@ JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_Display_getAvailableDisplayModes
XCloseDisplay(disp); XCloseDisplay(disp);
return NULL; return NULL;
} }
int screen = DefaultScreen(disp);
if (!loadGL(disp, screen)) { if (!loadGL(disp, screen)) {
#ifdef _DEBUG #ifdef _DEBUG
printf("Could not load GL\n"); printf("Could not load GL\n");