Bail out on NULL

This commit is contained in:
simon.kagstrom 2009-01-10 16:20:51 +00:00
parent fce0db49b7
commit 21bca49baa
2 changed files with 13 additions and 2 deletions

View File

@ -27,9 +27,9 @@ INCLUDES :=
PCFLAGS = -DPRECISE_CPU_CYCLES=1 -DPRECISE_CIA_CYCLES=1 -DPC_IS_POINTER=0
CFLAGS = -O2 -g -Wall $(MACHDEP) $(INCLUDE) -I$(DEVKITPRO)/SDL/include -U__unix -DHAVE_SDL
CXXFLAGS = $(CFLAGS)
CXXFLAGS = $(CFLAGS)
LDFLAGS = -L$(DEVKITPRO)/SDL/lib -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
LDFLAGS = -L$(DEVKITPRO)/SDL/lib -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project

View File

@ -83,8 +83,19 @@ int init_graphics(void)
screen = SDL_CreateRGBSurface(SDL_SWSURFACE, DISPLAY_X, DISPLAY_Y + 17, 8,
rmask, gmask, bmask, amask);
if (!screen)
{
fprintf(stderr, "Cannot allocate surface to draw on: %s\n",
SDL_GetError);
exit(1);
}
real_screen = SDL_SetVideoMode(FULL_DISPLAY_X, FULL_DISPLAY_Y, 8,
SDL_DOUBLEBUF);
if (!real_screen)
{
fprintf(stderr, "\n\nCannot initialize video: %s\n", SDL_GetError());
exit(1);
}
return 1;
}