Skip to content

Commit

Permalink
(#110) Fixed texture path parsing inconsistencies
Browse files Browse the repository at this point in the history
Bug Fixes:
- switched to getting specific token length rather than token array length
- corrected start position for 3-length tokens (originally, it would cut off some of the parsed path)
  • Loading branch information
lucasstarsz committed Aug 28, 2021
1 parent 35ddb4c commit 3c23d10
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/tech/fastj/resources/models/PsdfUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,14 @@ private static String parseTexture(String[] tokens) {
if (tokens.length == 2) {
pathBuilder.append(tokens[1], 1, tokens[1].length() - 1);
} else if (tokens.length == 3) {
pathBuilder.append(tokens[1], 1, tokens.length);
pathBuilder.append(tokens[2], 2, tokens.length - 1);
pathBuilder.append(tokens[1], 1, tokens[1].length());
pathBuilder.append(tokens[2], 0, tokens[2].length() - 1);
} else {
pathBuilder.append(tokens[1], 1, tokens.length);
for (int i = 2; i < tokens.length - 1; i++) {
pathBuilder.append(tokens[i]);
}
pathBuilder.append(tokens[tokens.length - 1], 0, tokens.length - 1);
pathBuilder.append(tokens[tokens.length - 1], 0, tokens[tokens.length - 1].length() - 1);
}

return pathBuilder.toString();
Expand Down

0 comments on commit 3c23d10

Please sign in to comment.