fix: Minecraft 1.20 crashing the semver parser #12

Merged
Ecorous merged 6 commits from fix/semver-crash-mc1.20 into main 2024-07-07 07:50:52 -04:00
Owner

Minecraft doesn't use semver, and as such, sometimes it can cause problems, like in this case: 1.20 is not a valid semver version, but we must deal with it anyway, we've made the <patch> component optional, defaulting it to 0 if missing

Minecraft doesn't use semver, and as such, sometimes it can cause problems, like in this case: `1.20` is not a valid semver version, but we must deal with it anyway, we've made the `<patch>` component optional, defaulting it to `0` if missing
ender added 1 commit 2024-07-05 19:28:52 -04:00
Minecraft doesn't use semver, and as such, sometimes it can cause problems, like in this case: `1.20` is not a valid semver version, but we must deal with it anyway, we've made the `<patch>` component optional, defaulting it to `0` if missing
ender force-pushed fix/semver-crash-mc1.20 from 6eeade90b0 to de85222cbf 2024-07-05 19:29:13 -04:00 Compare
ender requested review from Ecorous 2024-07-05 19:30:46 -04:00
ender requested review from owlsys 2024-07-05 19:30:47 -04:00
owlsys reviewed 2024-07-05 19:30:54 -04:00
@ -30,1 +32,3 @@
int patch = Integer.parseInt(matcher.group("patch"));
// minecraft treats the `patch` component as optional...
@Nullable String patchString = matcher.group("patch");
int patch = patchString == null ? 0 : Integer.parseInt(matcher.group("patch"));
Owner

nitpick: could use the previously assigned variable in the Integer.parseInt call

nitpick: could use the previously assigned variable in the `Integer.parseInt` call
Author
Owner

wdym?

wdym?
Owner
int patch = patchString == null ? 0 : Integer.parseInt(matcher.group(patchString));
```java int patch = patchString == null ? 0 : Integer.parseInt(matcher.group(patchString)); ```
Author
Owner

i'm not understanding sorry, what should i change it to?

i'm not understanding sorry, what should i change it to?
Author
Owner

OH, got it, forgot to actually us the var i added lol

OH, got it, forgot to actually us the var i added lol
owlsys marked this conversation as resolved
ender added 3 commits 2024-07-05 19:32:38 -04:00
Minecraft doesn't use semver, and as such, sometimes it can cause problems, like in this case: `1.20` is not a valid semver version, but we must deal with it anyway, we've made the `<patch>` component optional, defaulting it to `0` if missing
It Was added by me for testing and forgot to remove it :/
ender added 1 commit 2024-07-05 19:36:51 -04:00
owlsys approved these changes 2024-07-05 21:09:09 -04:00
Ecorous approved these changes 2024-07-07 07:47:15 -04:00
Ecorous added 1 commit 2024-07-07 07:49:14 -04:00
Ecorous merged commit a0c7d27fec into main 2024-07-07 07:50:52 -04:00
Ecorous deleted branch fix/semver-crash-mc1.20 2024-07-07 07:50:57 -04:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: frogmc/FrogLoader#12
No description provided.