|
|
@ -1377,7 +1377,7 @@ int tinyobj_parse_obj(tinyobj_attrib_t *attrib, tinyobj_shape_t **shapes, |
|
|
|
/* Create a null terminated string */ |
|
|
|
char* material_name_null_term = (char*) TINYOBJ_MALLOC(commands[i].material_name_len + 1); |
|
|
|
memcpy((void*) material_name_null_term, (const void*) commands[i].material_name, commands[i].material_name_len); |
|
|
|
material_name_null_term[commands[i].material_name_len - 1] = 0; |
|
|
|
material_name_null_term[commands[i].material_name_len] = 0; |
|
|
|
|
|
|
|
if (hash_table_exists(material_name_null_term, &material_table)) |
|
|
|
material_id = (int)hash_table_get(material_name_null_term, &material_table); |
|
|
|