Fixed an issue that prevented models from being loaded correctly when some model indices in MODELDEF were unused. Fixes #727

This commit is contained in:
biwa 2022-04-23 17:23:22 +02:00
parent 7d7e2e98b4
commit 3cda0e53d1

View file

@ -200,7 +200,7 @@ namespace CodeImp.DoomBuilder.ZDoom
foreach(var fs in mds.Frames[targetsprite]) foreach(var fs in mds.Frames[targetsprite])
{ {
// Sanity checks // 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); LogWarning("Model definition \"" + classname + "\", frame \"" + fs.SpriteName + " " + fs.FrameName + "\" references undefined model index " + fs.ModelIndex);
continue; continue;