Program: Add bounds check to prevent generating more than 256 rotations

This commit is contained in:
OatmealDome 2024-09-19 01:52:22 -04:00
parent c68a64f2b5
commit 3d65678022

View File

@ -1,4 +1,4 @@
using System.CommandLine;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.Text.Json;
using OatmealDome.BinaryData;
@ -215,6 +215,11 @@ void Run(InvocationContext context)
loopTime = loopTime.AddHours(length);
}
if (maximumPhases > 256)
{
throw new Exception("Gambit can only load up to 256 rotations at a time");
}
Console.WriteLine($"Generating {maximumPhases} phases to reach {endTime:O} (already have {currentPhases.Count})");