@@ -956,15 +956,20 @@ objzModel *objz_load(const char *_filename) {
956956 object -> numFaces += faces .length - prevFacesLength ;
957957 }
958958 } else if (OBJZ_STRICMP (token .text , "g" ) == 0 || OBJZ_STRICMP (token .text , "o" ) == 0 ) {
959+ const bool isGroup = OBJZ_STRICMP (token .text , "g" ) == 0 ;
959960 tokenize (& lexer , & token , true);
960- if (token .text [0 ] == 0 ) {
961- appendError ("(%u:%u) Expected name after 'g'/'o'" , token .line , token .column );
962- goto error ;
961+ if (isGroup ) {
962+ // Empty group names are permitted.
963+ if (token .text [0 ] != 0 )
964+ strCopy (currentGroupName , sizeof (currentGroupName ), token .text , strLength (token .text , sizeof (token .text )));
963965 }
964- if (OBJZ_STRICMP (token .text , "g" ) == 0 )
965- strCopy (currentGroupName , sizeof (currentGroupName ), token .text , strLength (token .text , sizeof (token .text )));
966- else
966+ else {
967+ if (token .text [0 ] == 0 ) {
968+ appendError ("(%u:%u) Expected name after 'o'" , token .line , token .column );
969+ goto error ;
970+ }
967971 strCopy (currentObjectName , sizeof (currentObjectName ), token .text , strLength (token .text , sizeof (token .text )));
972+ }
968973 TempObject o ;
969974 o .name [0 ] = 0 ;
970975 if (currentGroupName [0 ] != 0 )
0 commit comments