1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-16 12:35:22 +00:00

Check if MPQ file was loaded before reading. (#125)

And if it wasn't then tell the user which one instead of crashing.
This commit is contained in:
Ziemas 2019-11-10 00:57:55 +01:00 committed by Tim Sarbin
parent 4aba58eb28
commit 948ca1fc1a

View File

@ -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
}