fixed bug: Unable to load the empty file (closes #141)
This commit is contained in:
parent
1cb6110985
commit
c97b972172
@ -1268,7 +1268,7 @@ void* read_file_to_memory(char * path, size_t* file_size)
|
|||||||
*file_size = buf.st_size;
|
*file_size = buf.st_size;
|
||||||
FILE* fd = fopen(path, "r");
|
FILE* fd = fopen(path, "r");
|
||||||
char* content = malloc(*file_size);
|
char* content = malloc(*file_size);
|
||||||
if (fread(content, *file_size, 1, fd) != 1)
|
if (*file_size != 0 && fread(content, *file_size, 1, fd) != 1)
|
||||||
{
|
{
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user