diff options
Diffstat (limited to 'obj.c')
-rw-r--r-- | obj.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -1,5 +1,8 @@ /* obj.c * + * Kamil Kaminski + * kamilkss@gmail.com + * * OBJ Loader * initial code: http://www.gamedev.net/community/forums/topic.asp?topic_id=312335 * @@ -21,6 +24,10 @@ ObjModel* ObjLoadModel(char *memory, size_t size) /* initialize to zero */ memset(ret, 0, sizeof(ObjModel)); + /* if size is 0, meaning file was not loaded correctly, return null */ + if (!size) + return ret; + p = memory; e = memory + size; @@ -228,6 +235,9 @@ size_t ObjLoadFile(char *szFileName, char **memory) fclose(file); } + else + perror("fopen"); + return bytes; } |