From 6185b85f7b3bf0421023f9cf17637252fb7a998e Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Fri, 19 Apr 2019 14:37:46 -0700 Subject: [PATCH] Fix crash on asm gen when no settings file exists --- README.md | 6 +++--- SourceGen/AsmGen/AssemblerConfig.cs | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9a5b5af..cbb8ea3 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,9 @@ as well as many less-common ones. processor status flags are tracked, allowing identification of branches that are always/never taken, accurate cycle count listings, and correct analysis of 65816 code with variable-width registers. -- Easy generation of assembly source code in popular formats (currently - cc65 and Merlin 32). Cross-assemblers can be invoked from the GUI to - verify correctness. +- Easy generation of assembly source code for popular cross-assemblers + (currently cc65, 64tass, and Merlin 32). Cross-assemblers can be invoked + from the GUI to verify correctness. - Symbols and constants are provided for ROM and operating system entry points on several popular systems. - Project files are designed for sharing and collaboration. diff --git a/SourceGen/AsmGen/AssemblerConfig.cs b/SourceGen/AsmGen/AssemblerConfig.cs index 8c38725..443397a 100644 --- a/SourceGen/AsmGen/AssemblerConfig.cs +++ b/SourceGen/AsmGen/AssemblerConfig.cs @@ -68,14 +68,17 @@ namespace SourceGen.AsmGen { /// /// Creates a populated AssemblerConfig from the app settings for the specified ID. + /// If the assembler hasn't been configured yet, the default configuration object + /// will be returned. /// /// Settings object to pull the values from. /// Assembler ID. - /// The AssemblerConfig, or null if not configured. + /// The AssemblerConfig. public static AssemblerConfig GetConfig(AppSettings settings, AssemblerInfo.Id id) { string cereal = settings.GetString(GetSettingName(id), null); if (string.IsNullOrEmpty(cereal)) { - return null; + IAssembler asm = AssemblerInfo.GetAssembler(id); + return asm.GetDefaultConfig(); } JavaScriptSerializer ser = new JavaScriptSerializer();