Fixed, ACS parser: fixed another crash when trying to load zero-length acs lump/file.

This commit is contained in:
MaxED 2015-11-28 23:31:54 +00:00
parent 6d0823b943
commit e3cbe79113
3 changed files with 14 additions and 10 deletions

View file

@ -19,16 +19,17 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Config;
using System.Threading;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Windows;
using CodeImp.DoomBuilder.ZDoom;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Compilers;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.GZBuilder.Data;
using CodeImp.DoomBuilder.GZBuilder.GZDoom;
using CodeImp.DoomBuilder.GZBuilder.MD3;
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Windows;
using CodeImp.DoomBuilder.ZDoom;
#endregion
@ -1419,7 +1420,7 @@ namespace CodeImp.DoomBuilder.Data
if(decorate.HasError)
{
General.ErrorLogger.Add(ErrorType.Error, "DECORATE error in '" + decorate.ErrorSource
+ "', line " + decorate.ErrorLine + ". " + decorate.ErrorDescription + ".");
+ (decorate.ErrorLine != CompilerError.NO_LINE_NUMBER ? "', line " + decorate.ErrorLine : "'") + ". " + decorate.ErrorDescription + ".");
break;
}
}

View file

@ -49,12 +49,14 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
public bool Parse(Stream stream, string sourcefilename, List<string> configincludes, bool processincludes, bool isinclude)
{
// Integrity check
if(!base.Parse(stream, sourcefilename) || stream == null || stream.Length == 0)
if(stream == null || stream.Length == 0)
{
ReportError("Unable to load " + (isinclude ? "include" : "") + " file '" + sourcefilename + "'!");
return false;
}
base.Parse(stream, sourcefilename);
// Already parsed this?
if(parsedlumps.Contains(sourcefilename)) return false;
parsedlumps.Add(sourcefilename);

View file

@ -20,6 +20,7 @@ using System;
using System.Globalization;
using System.Text;
using System.IO;
using CodeImp.DoomBuilder.Compilers;
#endregion
@ -464,7 +465,7 @@ namespace CodeImp.DoomBuilder.ZDoom
{
// Set error information
errordesc = message;
errorline = GetCurrentLineNumber();
errorline = (datastream != null ? GetCurrentLineNumber() : CompilerError.NO_LINE_NUMBER); //mxd
errorsource = sourcename;
}