[SDL] EXC_BAD_ACCESS on SDL_ConvertSurface Mac OS X
Albert Zeyer
albert.zeyer at rwth-aachen.de
Sat Mar 8 15:35:33 PST 2008
Am Samstag, den 08.03.2008, 15:23 -0800 schrieb thecommodore6:
>
>
> Albert Zeyer wrote:
> >
> >> // Load tiles.bmp into the temp surface, then convert it to
> >> the format of
> >> gScreen and save it to gTiles, then free the temp surface
> >> SDL_Surface *temp = SDL_LoadBMP("tiles.bmp");
> >> gTiles = SDL_ConvertSurface(temp, gScreen->format,
> >> SDL_SWSURFACE);
> >> SDL_FreeSurface(temp);
> >
> >
> > At which line do you get this error?
> >
> > Is temp != NULL after SDL_LoadBMP ?
> >
> > Is gTiles != NULL after SDL_ConvertSurface ?
> >
>
> This error arises on the line gTiles = SDL_ConvertSurface(...); when I try
> to step over it in the debugger.
>
> After SDL_LoadBMP, temp == NULL, which to me seems like it could be an
> issue, I just don't know how to change that.
>
> I cannot check what gTiles is after SDL_ConvertSurface because the program
> freezes at that line and will not continue.
>
> Is the fact that temp == NULL the issue here? If so, how can I change that?
Of course that is an issue. It meens that there is no surface. Of course
SDL_ConvertSurface cannot convert *nothing* (NULL).
So SDL_LoadBMP cannot load the bmp. Returning NULL means that nothing
was loaded.
Probably SDL_LoadBMP doesn't find the file. Ensure that the bmp is
really in the same directory from where you are starting the
application.
More information about the SDL
mailing list