A null header from features is an error

This commit is contained in:
Matt Nadareski
2021-03-19 17:11:03 -07:00
parent b32a630780
commit c2fa50f28f
2 changed files with 22 additions and 6 deletions

View File

@@ -1756,7 +1756,8 @@ Some special strings that can be used:
/// <summary> /// <summary>
/// Pre-configured DatHeader /// Pre-configured DatHeader
/// </summary> /// </summary>
protected DatHeader Header { get; set; } /// <remarks>Public because it's an indicator something went wrong</remarks>
public DatHeader Header { get; set; }
/// <summary> /// <summary>
/// Lowest log level for output /// Lowest log level for output
@@ -2140,10 +2141,19 @@ Some special strings that can be used:
foreach (string ot in GetList(features, OutputTypeListValue)) foreach (string ot in GetList(features, OutputTypeListValue))
{ {
DatFormat dftemp = GetDatFormat(ot); DatFormat dftemp = GetDatFormat(ot);
if (dftemp == DatFormat.Logiqx && deprecated) if (dftemp == 0x00)
{
logger.Error($"{ot} is not a recognized DAT format");
return null;
}
else if (dftemp == DatFormat.Logiqx && deprecated)
{
datHeader.DatFormat |= DatFormat.LogiqxDeprecated; datHeader.DatFormat |= DatFormat.LogiqxDeprecated;
}
else else
{
datHeader.DatFormat |= dftemp; datHeader.DatFormat |= dftemp;
}
} }
return datHeader; return datHeader;
@@ -2207,7 +2217,6 @@ Some special strings that can be used:
return remover; return remover;
} }
/// <summary> /// <summary>
/// Get Splitter from feature list /// Get Splitter from feature list
/// </summary> /// </summary>

View File

@@ -126,7 +126,7 @@ namespace SabreTools
case Stats.Value: case Stats.Value:
case Update.Value: case Update.Value:
case Verify.Value: case Verify.Value:
VerifyInputs(feature.Inputs, featureName); VerifyInputs(feature.Inputs, feature);
feature.ProcessFeatures(features); feature.ProcessFeatures(features);
break; break;
@@ -185,12 +185,19 @@ namespace SabreTools
/// </summary> /// </summary>
/// <param name="inputs">List of inputs</param> /// <param name="inputs">List of inputs</param>
/// <param name="feature">Name of the current feature</param> /// <param name="feature">Name of the current feature</param>
private static void VerifyInputs(List<string> inputs, string feature) private static void VerifyInputs(List<string> inputs, BaseFeature feature)
{ {
if (inputs.Count == 0) if (inputs.Count == 0)
{ {
logger.Error("This feature requires at least one input"); logger.Error("This feature requires at least one input");
_help.OutputIndividualFeature(feature); _help.OutputIndividualFeature(feature.Name);
Environment.Exit(0);
}
if (feature.Header == null)
{
logger.Error("Please check for errors in parameters");
_help.OutputIndividualFeature(feature.Name);
Environment.Exit(0); Environment.Exit(0);
} }
} }