From d12b2f35c00992303759611c609fd85b5c0891bb Mon Sep 17 00:00:00 2001 From: TheEpicBlock <61842090+TheEpicBlock@users.noreply.github.com> Date: Sun, 2 Nov 2025 00:57:34 +0100 Subject: [PATCH] Fix loader comparison when unrecognized loader is encountered (#372) Since an unrecognized loader has an index of -1, and since lower number indicate a better loader, an unrecognized loader (when found in b) would immediately be assumed to be a great loader. Since the loop for A properly handles it, B would always be assumed to be the best, which has quite wrong consequences. --- modrinth/modrinth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modrinth/modrinth.go b/modrinth/modrinth.go index fa870c3..96515e5 100644 --- a/modrinth/modrinth.go +++ b/modrinth/modrinth.go @@ -260,7 +260,7 @@ func compareLoaderLists(a []string, b []string) int32 { continue } idx := slices.Index(loaderPreferenceList, v) - if idx < minIdxA { + if idx != -1 && idx < minIdxA { return 1 // B has more preferable loaders } if idx != -1 && idx < minIdxB {