mirror of
https://github.com/haven1433/HexManiacAdvance.git
synced 2026-05-21 04:38:05 -05:00
Don't crash when writing a ! end token into the anchor editor
This commit is contained in:
parent
01d401193d
commit
3ed6d9f9c7
|
|
@ -70,6 +70,7 @@ namespace HavenSoft.HexManiac.Core.Models.Runs {
|
|||
return new FixedLengthStreamStrategy(number);
|
||||
}
|
||||
if (endToken.StartsWith("!") && endToken.Length % 2 == 1 && endToken.Substring(1).All(ViewModels.ViewPort.AllHexCharacters.Contains)) {
|
||||
if (endToken.Length == 1) return null; // end token must be at least 1 byte long
|
||||
return new EndCodeStreamStrategy(model, endToken.Substring(1).ToUpper());
|
||||
}
|
||||
var tokens = endToken.Split("/");
|
||||
|
|
|
|||
|
|
@ -746,6 +746,13 @@ namespace HavenSoft.HexManiac.Tests {
|
|||
Assert.Equal("bob|=4+a", segment.SerializeFormat);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CreateTable_BadEndTokenFormat_NoCrash() {
|
||||
ViewPort.Edit("^table[a:]1 ");
|
||||
ViewPort.AnchorText = "^table[a:]!";
|
||||
Assert.Single(Errors);
|
||||
}
|
||||
|
||||
private void ArrangeTrainerPokemonTeamData(byte structType, byte pokemonCount, int trainerCount) {
|
||||
CreateTextTable(HardcodeTablesModel.PokemonNameTable, 0x180, "ABCDEFGHIJKLMNOP".Select(c => c.ToString()).ToArray());
|
||||
CreateTextTable(HardcodeTablesModel.MoveNamesTable, 0x1B0, "qrstuvwxyz".Select(c => c.ToString()).ToArray());
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user