From 589ff9bb3667e03d9b4ba0fda9141627424d9d9b Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Sat, 25 Jan 2020 18:23:27 -0800 Subject: [PATCH] Don't create bad DefSymbol When editing an instruction operand, if you click "edit project symbol", we need an initial value for the label. If you started typing something in the instruction operand symbol field, we use that. Unfortunately we were trying to use that even when it was invalid, which caused an assertion to go off in the DefSymbol constructor. --- SourceGen/WpfGui/EditInstructionOperand.xaml.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SourceGen/WpfGui/EditInstructionOperand.xaml.cs b/SourceGen/WpfGui/EditInstructionOperand.xaml.cs index 3daee19..94219fe 100644 --- a/SourceGen/WpfGui/EditInstructionOperand.xaml.cs +++ b/SourceGen/WpfGui/EditInstructionOperand.xaml.cs @@ -1005,8 +1005,9 @@ namespace SourceGen.WpfGui { if (origSym == null) { // Need to start with a symbol so we can set the value field. string symName = "SYM"; - if (!string.IsNullOrEmpty(SymbolLabel)) { - symName = SymbolLabel; // may not be valid, but it doesn't have to be + if (!string.IsNullOrEmpty(SymbolLabel) && + Asm65.Label.ValidateLabel(SymbolLabel)) { + symName = SymbolLabel; } origSym = new DefSymbol(symName, mOperandValue, Symbol.Source.Project, Symbol.Type.ExternalAddr, FormatDescriptor.SubType.None);