浏览代码

stb_image: stbi__bmp_info only rewind stream on error

To be consistent with the other info functions.

Fixes issue #892.
Fabian Giesen 4 年之前
父节点
当前提交
17bc84e15d
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      stb_image.h

+ 3 - 2
stb_image.h

@@ -7205,9 +7205,10 @@ static int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp)
 
    info.all_a = 255;
    p = stbi__bmp_parse_header(s, &info);
-   stbi__rewind( s );
-   if (p == NULL)
+   if (p == NULL) {
+      stbi__rewind( s );
       return 0;
+   }
    if (x) *x = s->img_x;
    if (y) *y = s->img_y;
    if (comp) {