Guard access to Display in GLPlatform::getXServerVersion

On wayland OpenGL might get initialized before we have a connection
to the XServer and we might only have an xcb connection. So let's
guard the access.
This commit is contained in:
Martin Gräßlin 2015-02-23 13:17:46 +01:00
parent 820af0ce4a
commit f1f87c7a7d

View file

@ -62,7 +62,7 @@ static qint64 getXServerVersion()
qint64 major, minor, patch; qint64 major, minor, patch;
Display *dpy = display(); Display *dpy = display();
if (strstr(ServerVendor(dpy), "X.Org")) { if (dpy && strstr(ServerVendor(dpy), "X.Org")) {
const int release = VendorRelease(dpy); const int release = VendorRelease(dpy);
major = (release / 10000000); major = (release / 10000000);
minor = (release / 100000) % 100; minor = (release / 100000) % 100;