From 3cda0e53d19e636647b964276ca1de08c4a18409 Mon Sep 17 00:00:00 2001 From: biwa <6475593+biwa@users.noreply.github.com> Date: Sat, 23 Apr 2022 17:23:22 +0200 Subject: [PATCH] Fixed an issue that prevented models from being loaded correctly when some model indices in MODELDEF were unused. Fixes #727 --- Source/Core/ZDoom/ModeldefParser.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/ZDoom/ModeldefParser.cs b/Source/Core/ZDoom/ModeldefParser.cs index 8ce1fe2c..8e69d0a2 100755 --- a/Source/Core/ZDoom/ModeldefParser.cs +++ b/Source/Core/ZDoom/ModeldefParser.cs @@ -200,7 +200,7 @@ namespace CodeImp.DoomBuilder.ZDoom foreach(var fs in mds.Frames[targetsprite]) { // Sanity checks - if(fs.ModelIndex >= mds.ModelNames.Count || string.IsNullOrEmpty(mds.ModelNames[fs.ModelIndex])) + if (!mds.ModelNames.ContainsKey(fs.ModelIndex) || string.IsNullOrEmpty(mds.ModelNames[fs.ModelIndex])) { LogWarning("Model definition \"" + classname + "\", frame \"" + fs.SpriteName + " " + fs.FrameName + "\" references undefined model index " + fs.ModelIndex); continue;