MODELDEF: Fixed a crash when a FrameIndex tried to reference a model index that wasn't defined. Fixes #578

This commit is contained in:
biwa 2021-06-24 17:45:02 +02:00
parent 9055170a61
commit 2407b2d1f3

View file

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