From 948ca1fc1ac3e8cfe4a5f18e9cf352a9f7cdde9d Mon Sep 17 00:00:00 2001 From: Ziemas Date: Sun, 10 Nov 2019 00:57:55 +0100 Subject: [PATCH] Check if MPQ file was loaded before reading. (#125) And if it wasn't then tell the user which one instead of crashing. --- core/Engine.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/Engine.go b/core/Engine.go index 84762be6..63d54231 100644 --- a/core/Engine.go +++ b/core/Engine.go @@ -109,6 +109,9 @@ func (v *Engine) LoadFile(fileName string) []byte { } for _, mpqFile := range v.Settings.MpqLoadOrder { archive, _ := mpq.Load(path.Join(v.Settings.MpqPath, mpqFile)) + if archive == nil { + log.Fatalf("Failed to load specified MPQ file: %s", mpqFile) + } if !archive.FileExists(fileName) { continue }