Fix crash with new CurseForge metadata (added NeoForge)

This commit is contained in:
comp500 2023-07-30 14:10:47 +01:00
parent 39b9c300cc
commit 9c856e3d54
2 changed files with 4 additions and 1 deletions

View File

@ -253,7 +253,7 @@ func filterLoaderTypeIndex(packLoaders []string, modLoaderType modloaderType) (m
// No loaders are specified: allow all files
return modloaderTypeAny, true
} else {
if slices.Contains(packLoaders, modloaderIds[modLoaderType]) {
if int(modLoaderType) < len(modloaderIds) && slices.Contains(packLoaders, modloaderIds[modLoaderType]) {
// Pack contains this loader, pass through
return modLoaderType, true
} else {

View File

@ -116,6 +116,7 @@ const (
modloaderTypeLiteloader
modloaderTypeFabric
modloaderTypeQuilt
modloaderTypeNeoForge
)
var modloaderNames = [...]string{
@ -125,6 +126,7 @@ var modloaderNames = [...]string{
"Liteloader",
"Fabric",
"Quilt",
"NeoForge",
}
var modloaderIds = [...]string{
@ -134,6 +136,7 @@ var modloaderIds = [...]string{
"liteloader",
"fabric",
"quilt",
"neoforge",
}
type hashAlgo uint8