From 4a35078f9011a685a9fbe3a8aaeb78a01e3682d2 Mon Sep 17 00:00:00 2001 From: = <=> Date: Tue, 26 Nov 2024 15:37:35 -0700 Subject: [PATCH] more error checking on modpack downloads --- fclauncher/InstanceManager.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fclauncher/InstanceManager.go b/fclauncher/InstanceManager.go index 6b82b28..8f6f400 100644 --- a/fclauncher/InstanceManager.go +++ b/fclauncher/InstanceManager.go @@ -485,7 +485,11 @@ outer: func (i *InstanceManager) ImportModpack(modpack Modpack, name string) { i.app.Status(fmt.Sprintf("Downloading %s", modpack.Name)) buff := new(bytes.Buffer) - HttpDownload(filepath.Join(modpack.Id, modpack.Versions[len(modpack.Versions)-1].File), buff, i.app.Ctx) + err := HttpDownload(filepath.Join(modpack.Id, modpack.Versions[len(modpack.Versions)-1].File), buff, i.app.Ctx) + if err != nil { + fmt.Printf("Unable to download modpack file: %s\n", err) + return + } i.ImportMrpack(buff, name) } @@ -503,6 +507,7 @@ func (i *InstanceManager) ImportMrpack(data io.Reader, name string) { } if err != nil { fmt.Printf("Error unpacking modpack file: %s\n", err) + break } if entry.Name == "modrinth.index.json" { i.app.Status("Loading metadata")