don't barf when when getFileContents can't open file

This commit is contained in:
aap 2020-12-03 20:45:43 +01:00
parent efc0c307d7
commit 92b215268a

View File

@ -1107,7 +1107,8 @@ uint8*
getFileContents(const char *name, uint32 *len) getFileContents(const char *name, uint32 *len)
{ {
FILE *cf = fopen(name, "rb"); FILE *cf = fopen(name, "rb");
assert(cf != nil); if(cf == nil)
return nil;
fseek(cf, 0, SEEK_END); fseek(cf, 0, SEEK_END);
*len = ftell(cf); *len = ftell(cf);
fseek(cf, 0, SEEK_SET); fseek(cf, 0, SEEK_SET);