Quickie segfault

found a quicky segfault, in dx5video.c.

both DX5_SetGammaRamp and DX5GetGammaRamp use SDL_Primary
in the call to IDirectDrawSurface3_QueryInterface.

if i call either of these functions before calling
SDL_SetVideoMode… you guessed it, NULL pointers.
it should be easy enough to check these values before
use.
(easy enough i’m not bothering with sending patch, sorry)

on another note. this sets me back on my “Gamma Detection”.
I suppose only check for working gamma routines after
creating a window? it seems it would be perfect for me
to check SDL_VideoDevice::SetGammaRamp for non NULL.
now if only i could see that info from “outside” SDL.

owell, i’ll figure something out for myself, but i
found this little bug and thought i’d pass it on.

found a quicky segfault, in dx5video.c.

both DX5_SetGammaRamp and DX5GetGammaRamp use SDL_Primary
in the call to IDirectDrawSurface3_QueryInterface.

if i call either of these functions before calling
SDL_SetVideoMode… you guessed it, NULL pointers.
it should be easy enough to check these values before
use.
(easy enough i’m not bothering with sending patch, sorry)

Thanks, fixed for SDL 1.1.6.

on another note. this sets me back on my “Gamma Detection”.
I suppose only check for working gamma routines after
creating a window?

That’s correct. Whether or not gamma correction is available depends
on the video mode you set. For example, 8-bit modes always have gamma
support, as this is handled inside SDL via palette lookups.

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software