mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2024-11-10 06:41:49 +00:00
Fixed: in some cases the editor could stuck in an infinite loop when searching for wad lumps.
This commit is contained in:
parent
4222e06c71
commit
5fd95f703d
1 changed files with 6 additions and 5 deletions
|
@ -452,15 +452,16 @@ namespace CodeImp.DoomBuilder.IO
|
|||
// This finds a lump by name, returns -1 when not found
|
||||
public int FindLumpIndex(string name, int start, int end)
|
||||
{
|
||||
if(name.Length > 8) return -1;//mxd. Can't be here. Go away!
|
||||
if(name.Length > 8 || lumps.Count == 0 || start > lumps.Count - 1) return -1;//mxd. Can't be here. Go away!
|
||||
|
||||
long longname = Lump.MakeLongName(name);
|
||||
|
||||
// Fix end when it exceeds length
|
||||
if(end > (lumps.Count - 1)) end = lumps.Count - 1;
|
||||
|
||||
// Fix start/end when they exceed safe bounds
|
||||
start = Math.Max(start, 0);
|
||||
end = General.Clamp(end, 0, lumps.Count - 1);
|
||||
|
||||
// Loop through the lumps
|
||||
for(int i = start; i <= end; i++)
|
||||
for (int i = start; i <= end; i++)
|
||||
{
|
||||
// Check if the lump name matches
|
||||
if(lumps[i].LongName == longname)
|
||||
|
|
Loading…
Reference in a new issue