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;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Windows.Forms;
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Config;
using System.Threading; using System.Threading;
using CodeImp.DoomBuilder.Map; using System.Windows.Forms;
using CodeImp.DoomBuilder.Windows; using CodeImp.DoomBuilder.Compilers;
using CodeImp.DoomBuilder.ZDoom; using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.GZBuilder.Data; using CodeImp.DoomBuilder.GZBuilder.Data;
using CodeImp.DoomBuilder.GZBuilder.GZDoom; using CodeImp.DoomBuilder.GZBuilder.GZDoom;
using CodeImp.DoomBuilder.GZBuilder.MD3; using CodeImp.DoomBuilder.GZBuilder.MD3;
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Windows;
using CodeImp.DoomBuilder.ZDoom;
#endregion #endregion
@ -1419,7 +1420,7 @@ namespace CodeImp.DoomBuilder.Data
if(decorate.HasError) if(decorate.HasError)
{ {
General.ErrorLogger.Add(ErrorType.Error, "DECORATE error in '" + decorate.ErrorSource 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; 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) public bool Parse(Stream stream, string sourcefilename, List<string> configincludes, bool processincludes, bool isinclude)
{ {
// Integrity check // 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 + "'!"); ReportError("Unable to load " + (isinclude ? "include" : "") + " file '" + sourcefilename + "'!");
return false; return false;
} }
base.Parse(stream, sourcefilename);
// Already parsed this? // Already parsed this?
if(parsedlumps.Contains(sourcefilename)) return false; if(parsedlumps.Contains(sourcefilename)) return false;
parsedlumps.Add(sourcefilename); parsedlumps.Add(sourcefilename);

View file

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