From b913541da4abb002df6bb61565774aee34af91fa Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Tue, 9 Jul 2024 16:08:57 -0700 Subject: [PATCH] Fix handling of operand wrap len == 0 This was supposed to select the default wrap length, but was actually returning zero, causing a crash when a project was opened if the settings file didn't happen to have the value specified. --- Asm65/Formatter.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Asm65/Formatter.cs b/Asm65/Formatter.cs index f4b9afa..a2b41da 100644 --- a/Asm65/Formatter.cs +++ b/Asm65/Formatter.cs @@ -119,7 +119,7 @@ namespace Asm65 { // /// Character position at which operands wrap; 0 == default. - public int OperandWrapLen = DEFAULT_OPERAND_WRAP_LEN; + public int OperandWrapLen { get; set; } = 0; /// Add spaces between bytes in the Bytes column? public bool SpacesBetweenBytes { get; set; } = false; // "20edfd" vs. "20 ed fd" @@ -137,14 +137,14 @@ namespace Asm65 { C64ScreenCode }; /// Character conversion mode for hex dumps. - public CharConvMode HexDumpCharConvMode = CharConvMode.Unknown; + public CharConvMode HexDumpCharConvMode { get; set; } = CharConvMode.Unknown; public enum ExpressionMode { Unknown = 0, Common, Cc65, Merlin }; /// /// This determines what operators are available and what their precedence is. Used /// when generating expressions for operands. /// - public ExpressionMode ExprMode = ExpressionMode.Unknown; + public ExpressionMode ExprMode { get; set; } = ExpressionMode.Unknown; /// @@ -569,7 +569,8 @@ namespace Asm65 { /// Point at which to wrap long operands, such as strings and dense hex. /// public int OperandWrapLen { - get { return mFormatConfig.OperandWrapLen; } + get { return mFormatConfig.OperandWrapLen == 0 ? + DEFAULT_OPERAND_WRAP_LEN : mFormatConfig.OperandWrapLen; } }