summaryrefslogtreecommitdiff
path: root/src/import
diff options
context:
space:
mode:
Diffstat (limited to 'src/import')
-rw-r--r--src/import/import.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/import/import.c b/src/import/import.c
index e2fc250..66bd541 100644
--- a/src/import/import.c
+++ b/src/import/import.c
@@ -9,7 +9,11 @@
void read_file(void *ctx, const char *filename, int is_mtl, const char *obj_filename, char **buf, size_t *len)
{
+ lua_State *L = ctx;
FILE *f = fopen(filename, "rb");
+ if (f == NULL) {
+ luaL_error(L, "failed to open file \"%s\"", filename);
+ }
fseek(f, 0, SEEK_END);
*len = ftell(f);
fseek(f, 0, SEEK_SET);