On Thu, 2004-07-01 at 13:17 -0300, Duilio Javier Protti wrote:
> > You shouldn't check if pal != NULL with debugging messages. pal is legal
> > to be NULL when not being in a 8bits mode.
>
> Ok, but we still deferencing the pointer, which can cause
> a segmentation fault. I have changed to this:
>
> static void sdl_set_pal ()
> {
> int i;
>
> visual_log_return_if_fail (screen != NULL);
>
> if (pal != NULL) {
> for (i = 0; i < 256; i ++) {
> sdlpal[i].r = pal->r[i];
> sdlpal[i].g = pal->g[i];
> sdlpal[i].b = pal->b[i];
> }
> SDL_SetColors (screen, sdlpal, 0, 256);
> }
> }
>
> Do you think is fine?
I think it's good like this, yes :)
|