Skip to content

Commit

Permalink
Fix 1.15 crash - Double check sorting is not null. (#476)
Browse files Browse the repository at this point in the history
- Fixed crash when sort mode is null
  • Loading branch information
MagnusHJensen authored Oct 17, 2022
1 parent fc54f2f commit 5e1cf69
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public boolean showLibraries() {
}

public Sorting getSorting() {
return sorting;
return sorting != null ? sorting : Sorting.ASCENDING;
}

public static enum Sorting {
public enum Sorting {
ASCENDING(Comparator.comparing(modContainer -> HardcodedUtil.formatFabricModuleName(modContainer.getMetadata().getName())), "modmenu.sorting.ascending"),
DECENDING(ASCENDING.getComparator().reversed(), "modmenu.sorting.decending");
DECENDING(ASCENDING.getComparator().reversed(), "modmenu.sorting.descending");

Comparator<ModContainer> comparator;
String translationKey;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/modmenu/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"modmenu.showingModsLibraries.1.1": "Showing %s mod and %s library",
"modmenu.sorting": "Sort: %s",
"modmenu.sorting.ascending": "A-Z",
"modmenu.sorting.decending": "Z-A",
"modmenu.sorting.descending": "Z-A",
"modmenu.minecraft": "Minecraft",
"modmenu.forge": "Forge"
}
2 changes: 1 addition & 1 deletion src/main/resources/assets/modmenu/lang/et_ee.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"modmenu.showingModsLibraries.a.a": "Kuvan %s modi ja %s teeki",
"modmenu.sorting": "Jrk: %s",
"modmenu.sorting.ascending": "A-Z",
"modmenu.sorting.decending": "Z-A",
"modmenu.sorting.descending": "Z-A",
"modmenu.minecraft": "Minecraft",
"modmenu.forge": "Forge"
}
2 changes: 1 addition & 1 deletion src/main/resources/assets/modmenu/lang/ja_jp.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"modmenu.showingMods": "%s個のmodを表示中",
"modmenu.sorting": "表示順: %s",
"modmenu.sorting.ascending": "昇順(A-Z)",
"modmenu.sorting.decending": "降順(Z-A)",
"modmenu.sorting.descending": "降順(Z-A)",
"modmenu.minecraft": "Minecraft"
}
2 changes: 1 addition & 1 deletion src/main/resources/assets/modmenu/lang/ru_ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"modmenu.showingModsLibraries.1.1": "Показано: %s мод и %s библиотека",
"modmenu.sorting": "Сортировка: %s",
"modmenu.sorting.ascending": "A-Z",
"modmenu.sorting.decending": "Z-A",
"modmenu.sorting.descending": "Z-A",
"modmenu.minecraft": "Minecraft",
"modmenu.forge": "Forge"
}
2 changes: 1 addition & 1 deletion src/main/resources/assets/modmenu/lang/sv_se.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"modmenu.showingModsLibraries.1.1": "Visar %s mod och %s Tillägg",
"modmenu.sorting": "Sortera: %s",
"modmenu.sorting.ascending": "A-Z",
"modmenu.sorting.decending": "Z-A",
"modmenu.sorting.descending": "Z-A",
"modmenu.minecraft": "Minecraft",
"modmenu.forge": "Forge"
}
2 changes: 1 addition & 1 deletion src/main/resources/assets/modmenu/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"modmenu.showingModsLibraries.1.1": "显示 %s 个模组和 %s 个运行库",
"modmenu.sorting": "排序方式: %s",
"modmenu.sorting.ascending": "A-Z",
"modmenu.sorting.decending": "Z-A",
"modmenu.sorting.descending": "Z-A",
"modmenu.minecraft": "Minecraft",
"modmenu.forge": "Forge"
}
3 changes: 2 additions & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"swordglowsblue",
"hinataaki",
"LeonXu98",
"magneticflux"
"magneticflux",
"legenden"
],
"description": "Adds a mod menu to view the list of mods you have installed.",
"mixins": [
Expand Down

0 comments on commit 5e1cf69

Please sign in to comment.