Browse Source

libcaption: Fix invalid data at utf8_load_text_file

Chensiyy 2 years ago
parent
commit
c97b5cf7ee
1 changed files with 4 additions and 1 deletions
  1. 4 1
      deps/libcaption/src/utf8.c

+ 4 - 1
deps/libcaption/src/utf8.c

@@ -220,7 +220,10 @@ utf8_char_t* utf8_load_text_file(const char* path, size_t* size)
         }
     }
 
-    data[*size] = 0;
+    if (data) {
+        data[*size] = 0;
+    }
+    
     return data;
 }