Linux: Added zero size check to display.c

This commit is contained in:
Elias Naur 2005-11-21 10:45:59 +00:00
parent 1d52341e60
commit 3099244b4f
1 changed files with 2 additions and 2 deletions

View File

@ -261,7 +261,7 @@ static bool setMode(JNIEnv *env, Display *disp, int screen, int width, int heigh
return false;
int num_modes, i;
mode_info *avail_modes = getDisplayModes(disp, screen, &num_modes);
if (avail_modes == NULL || num_modes == 0) {
if (avail_modes == NULL) {
printfDebugJava(env, "Could not get display modes");
return false;
}
@ -350,7 +350,7 @@ jobject initDisplay(JNIEnv *env, int screen) {
return NULL;
}
avail_modes = getDisplayModes(disp, screen, &num_modes);
if (avail_modes == NULL) {
if (avail_modes == NULL || num_modes == 0) {
throwException(env, "Could not get display modes");
XCloseDisplay(disp);
return NULL;