shithub: libobj

Download patch

ref: b31caa3645abe9ebed7885ceb7f9f9eff0524ee6
parent: ad65ff69d3ddeaf3b34cc9038bc28e79692f9656
author: rodri <rgl@antares-labs.eu>
date: Wed Mar 6 11:35:19 EST 2024

don't fail if there's no material file.

--- a/obj.c
+++ b/obj.c
@@ -281,11 +281,11 @@
 	int nf;
 
 	if((p = strrchr(curline.file, '/')) != nil)
-		snprint(buf, sizeof buf, "%.*s/%s", p-curline.file, curline.file, file);
+		snprint(buf, sizeof buf, "%.*s/%s", (int)(p-curline.file), curline.file, file);
 
 	bin = Bopen(buf, OREAD);
 	if(bin == nil)
-		sysfatal("Bopen: %r");
+		return nil;
 
 	ml = allocmtl(file);
 	m = nil;
@@ -728,7 +728,7 @@
 				*p = 0;
 				if((obj->materials = objmtlparse(buf)) == nil){
 					error("objmtlparse: %r");
-					goto error;
+					fprint(2, "%r");
 				}
 			}else if(strcmp(buf, "usemtl") == 0){
 				while(isspace(c))