mirror of https://github.com/encounter/SDL.git
Fixed crash if creating textures failed in testshape program.
This commit is contained in:
parent
00394996eb
commit
850185f401
|
@ -81,7 +81,6 @@ int main(int argc,char** argv)
|
||||||
pictures[i].surface = SDL_LoadBMP(argv[i+1]);
|
pictures[i].surface = SDL_LoadBMP(argv[i+1]);
|
||||||
pictures[i].name = argv[i+1];
|
pictures[i].name = argv[i+1];
|
||||||
if(pictures[i].surface == NULL) {
|
if(pictures[i].surface == NULL) {
|
||||||
j = 0;
|
|
||||||
for(j=0;j<num_pictures;j++)
|
for(j=0;j<num_pictures;j++)
|
||||||
SDL_FreeSurface(pictures[j].surface);
|
SDL_FreeSurface(pictures[j].surface);
|
||||||
SDL_free(pictures);
|
SDL_free(pictures);
|
||||||
|
@ -130,8 +129,7 @@ int main(int argc,char** argv)
|
||||||
for(i=0;i<num_pictures;i++) {
|
for(i=0;i<num_pictures;i++) {
|
||||||
pictures[i].texture = SDL_CreateTextureFromSurface(renderer,pictures[i].surface);
|
pictures[i].texture = SDL_CreateTextureFromSurface(renderer,pictures[i].surface);
|
||||||
if(pictures[i].texture == NULL) {
|
if(pictures[i].texture == NULL) {
|
||||||
j = 0;
|
for(i=0;i<num_pictures;i++)
|
||||||
for(j=0;j<num_pictures;i++)
|
|
||||||
if(pictures[i].texture != NULL)
|
if(pictures[i].texture != NULL)
|
||||||
SDL_DestroyTexture(pictures[i].texture);
|
SDL_DestroyTexture(pictures[i].texture);
|
||||||
for(i=0;i<num_pictures;i++)
|
for(i=0;i<num_pictures;i++)
|
||||||
|
|
Loading…
Reference in New Issue