Text parser: fixed a problem where the stream's position was not set correctly when checking the next token. Fixes #1010

This commit is contained in:
biwa 2024-01-14 20:29:18 +01:00
parent 66a0618e83
commit 14a494078a

View file

@ -545,6 +545,8 @@ namespace CodeImp.DoomBuilder.ZDoom
return false; return false;
} }
long prevstreamposition = DataStream.Position;
string token = ReadToken(); string token = ReadToken();
if(string.Compare(token, expectedtoken, true) != 0) if(string.Compare(token, expectedtoken, true) != 0)
@ -552,7 +554,7 @@ namespace CodeImp.DoomBuilder.ZDoom
if(reporterror) ReportError("Expected \"" + expectedtoken + "\", but got \"" + token + "\""); if(reporterror) ReportError("Expected \"" + expectedtoken + "\", but got \"" + token + "\"");
// Rewind so this structure can be read again // Rewind so this structure can be read again
DataStream.Seek(-token.Length, SeekOrigin.Current); DataStream.Seek(prevstreamposition, SeekOrigin.Begin);
return false; return false;
} }