瀏覽代碼

Don't overwrite the SDL_IOFromConstMem() error in testshape

Zack Middleton 1 年之前
父節點
當前提交
f212cb5f92
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      test/testshape.c

+ 6 - 1
test/testshape.c

@@ -60,7 +60,12 @@ int main(int argc, char *argv[])
             goto quit;
             goto quit;
         }
         }
     } else {
     } else {
-        shape = SDL_LoadBMP_IO(SDL_IOFromConstMem(glass_bmp, sizeof(glass_bmp)), true);
+        SDL_IOStream *stream = SDL_IOFromConstMem(glass_bmp, sizeof(glass_bmp));
+        if (!stream) {
+            SDL_Log("Couldn't create iostream for glass.bmp: %s\n", SDL_GetError());
+            goto quit;
+        }
+        shape = SDL_LoadBMP_IO(stream, true);
         if (!shape) {
         if (!shape) {
             SDL_Log("Couldn't load glass.bmp: %s\n", SDL_GetError());
             SDL_Log("Couldn't load glass.bmp: %s\n", SDL_GetError());
             goto quit;
             goto quit;