diff options
author | Daniel Borca <[email protected]> | 2004-01-07 13:54:17 +0000 |
---|---|---|
committer | Daniel Borca <[email protected]> | 2004-01-07 13:54:17 +0000 |
commit | 4c75d90ad21d40ae9a1965868cc992470421caff (patch) | |
tree | 622c094e606abe1cb83a819d0542df1371581d8f /src/mesa | |
parent | 63f025c5adba242c760fc3156b4aa92ee6f29f76 (diff) |
protect against broken apps
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/glide/fxwgl.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/mesa/drivers/glide/fxwgl.c b/src/mesa/drivers/glide/fxwgl.c index bba6c98cfc5..cf2d820bc74 100644 --- a/src/mesa/drivers/glide/fxwgl.c +++ b/src/mesa/drivers/glide/fxwgl.c @@ -827,10 +827,17 @@ wglSetPixelFormat(HDC hdc, int iPixelFormat, const PIXELFORMATDESCRIPTOR * ppfd) qt_valid_pix = qt_pix; - if (iPixelFormat < 1 || iPixelFormat > qt_valid_pix - || ppfd->nSize != sizeof(PIXELFORMATDESCRIPTOR)) { - SetLastError(0); - return (FALSE); + if (iPixelFormat < 1 || iPixelFormat > qt_valid_pix) { + if (ppfd == NULL) { + PIXELFORMATDESCRIPTOR my_pfd; + if (!wglDescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &my_pfd)) { + SetLastError(0); + return (FALSE); + } + } else if (ppfd->nSize != sizeof(PIXELFORMATDESCRIPTOR)) { + SetLastError(0); + return (FALSE); + } } curPFD = iPixelFormat; |