aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-02-20 16:50:13 +0000
committerrodri <rgl@antares-labs.eu>2024-02-20 16:50:13 +0000
commitad65ff69d3ddeaf3b34cc9038bc28e79692f9656 (patch)
tree4c0b097e5c1c1fb7531e92b5a1ac96d030c3b826
parentb4a0229a2dadca8c4d3a94d3e7176d022f09ec82 (diff)
downloadlibobj-ad65ff69d3ddeaf3b34cc9038bc28e79692f9656.tar.gz
libobj-ad65ff69d3ddeaf3b34cc9038bc28e79692f9656.tar.bz2
libobj-ad65ff69d3ddeaf3b34cc9038bc28e79692f9656.zip
don't try to find a material when the list is empty.
-rw-r--r--obj.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/obj.c b/obj.c
index de1c458..ef3f0fb 100644
--- a/obj.c
+++ b/obj.c
@@ -738,7 +738,7 @@ Line2:
*p++ = c;
}while(c = Bgetc(bin), (isalnum(c) || c == '.' || c == '_') && p-buf < sizeof(buf)-1);
*p = 0;
- if((m = getmtl(obj->materials, buf)) == nil){
+ if(obj->materials != nil && (m = getmtl(obj->materials, buf)) == nil){
error("no material '%s' found", buf);
goto error;
}