tests: Only copy con->modes[0] if it exists

con->modes can be NULL. Fixes crash in that case.

Closes: https://gitlab.freedesktop.org/mesa/drm/issues/34
Reviewed-by: Daniel Stone <daniels@collabora.com>
main
Michel Dänzer 2020-02-27 12:21:09 +01:00 committed by Michel Dänzer
parent 8a73372e62
commit fe06ee2054
1 changed files with 3 additions and 1 deletions

View File

@ -42,7 +42,9 @@ static void kms_screen_probe(struct kms_screen *screen)
else
screen->connected = false;
if (con->modes)
memcpy(&screen->mode, &con->modes[0], sizeof(drmModeModeInfo));
screen->width = screen->mode.hdisplay;
screen->height = screen->mode.vdisplay;