From 1980a475cad2347b6c9c3c060c5efb22ab4146d6 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Sun, 6 Oct 2019 14:38:49 -0700 Subject: [PATCH] Init all FormattedParts strings fields to an empty string Fixes issue #51. --- SourceGen/DisplayList.cs | 5 ++++- SourceGen/Exporter.cs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/SourceGen/DisplayList.cs b/SourceGen/DisplayList.cs index 23df263..f8941af 100644 --- a/SourceGen/DisplayList.cs +++ b/SourceGen/DisplayList.cs @@ -366,7 +366,10 @@ namespace SourceGen { // Private constructor -- create instances with factory methods. - private FormattedParts() { } + private FormattedParts() { + Offset = Addr = Bytes = Flags = Attr = Label = Opcode = Operand = Comment = + string.Empty; + } /// /// Clones the specified object. diff --git a/SourceGen/Exporter.cs b/SourceGen/Exporter.cs index 67d61d3..b1adc25 100644 --- a/SourceGen/Exporter.cs +++ b/SourceGen/Exporter.cs @@ -502,7 +502,7 @@ namespace SourceGen { bool suppressLabel = false; if (LongLabelNewLine && (line.LineType == LineListGen.Line.Type.Code || line.LineType == LineListGen.Line.Type.Data)) { - int labelLen = string.IsNullOrEmpty(parts.Label) ? 0 : parts.Label.Length; + int labelLen = parts.Label.Length; if (labelLen > maxLabelLen) { // put on its own line string lstr;