Browse Source

Don't crash the entire program on failed to open file.

rexim 2 years ago
parent
commit
082d00943a
1 changed files with 1 additions and 3 deletions
  1. 1 3
      img2term.c

+ 1 - 3
img2term.c

@@ -643,10 +643,8 @@ int main(int argc, char **argv)
             int width, height;
             int width, height;
             uint32_t *pixels = (uint32_t*)stbi_load(file_path, &width, &height, NULL, 4);
             uint32_t *pixels = (uint32_t*)stbi_load(file_path, &width, &height, NULL, 4);
             if (pixels == NULL) {
             if (pixels == NULL) {
-                // TODO: don't crash the entire program on failed to open file.
-                // Just continue processing the files.
                 fprintf(stderr, "ERROR: could not read file %s\n", file_path);
                 fprintf(stderr, "ERROR: could not read file %s\n", file_path);
-                exit(1);
+                continue;
             }
             }
 
 
             int resized_height = height*resized_width/width;
             int resized_height = height*resized_width/width;