Skip to content
This repository was archived by the owner on Jan 8, 2023. It is now read-only.

Commit 73e473a

Browse files
committed
Remove matcher find() duplication call
1 parent a29307d commit 73e473a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/main/java/io/github/spair/byond/dmi/slurper/MetaExtractor.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,6 @@ private static DmiMeta parseMetadataText(final String metadataText) {
7575
metadata.setSpritesHeight(Integer.parseInt(widthHeight.group(2)));
7676

7777
Matcher state = STATE_PATTERN.matcher(metadataText);
78-
79-
if (!state.find()) {
80-
throw new IllegalArgumentException("DMI meta does't contain any state property value");
81-
}
82-
state.reset();
83-
8478
List<DmiMetaEntry> entries = new ArrayList<>();
8579

8680
while (state.find()) {
@@ -91,6 +85,10 @@ private static DmiMeta parseMetadataText(final String metadataText) {
9185
entries.add(entry);
9286
}
9387

88+
if (entries.isEmpty()) {
89+
throw new IllegalArgumentException("DMI meta does't contain any state property value");
90+
}
91+
9492
metadata.setMetas(entries);
9593

9694
return metadata;

0 commit comments

Comments
 (0)