1
0
mirror of https://github.com/fadden/6502bench.git synced 2025-02-27 04:29:04 +00:00

Fix crash on asm gen when no settings file exists

This commit is contained in:
Andy McFadden 2019-04-19 14:37:46 -07:00
parent 6998eb4021
commit 6185b85f7b
2 changed files with 8 additions and 5 deletions

View File

@ -30,9 +30,9 @@ as well as many less-common ones.
processor status flags are tracked, allowing identification of branches processor status flags are tracked, allowing identification of branches
that are always/never taken, accurate cycle count listings, and correct that are always/never taken, accurate cycle count listings, and correct
analysis of 65816 code with variable-width registers. analysis of 65816 code with variable-width registers.
- Easy generation of assembly source code in popular formats (currently - Easy generation of assembly source code for popular cross-assemblers
cc65 and Merlin 32). Cross-assemblers can be invoked from the GUI to (currently cc65, 64tass, and Merlin 32). Cross-assemblers can be invoked
verify correctness. from the GUI to verify correctness.
- Symbols and constants are provided for ROM and operating system entry - Symbols and constants are provided for ROM and operating system entry
points on several popular systems. points on several popular systems.
- Project files are designed for sharing and collaboration.</li> - Project files are designed for sharing and collaboration.</li>

View File

@ -68,14 +68,17 @@ namespace SourceGen.AsmGen {
/// <summary> /// <summary>
/// Creates a populated AssemblerConfig from the app settings for the specified ID. /// 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.
/// </summary> /// </summary>
/// <param name="settings">Settings object to pull the values from.</param> /// <param name="settings">Settings object to pull the values from.</param>
/// <param name="id">Assembler ID.</param> /// <param name="id">Assembler ID.</param>
/// <returns>The AssemblerConfig, or null if not configured.</returns> /// <returns>The AssemblerConfig.</returns>
public static AssemblerConfig GetConfig(AppSettings settings, AssemblerInfo.Id id) { public static AssemblerConfig GetConfig(AppSettings settings, AssemblerInfo.Id id) {
string cereal = settings.GetString(GetSettingName(id), null); string cereal = settings.GetString(GetSettingName(id), null);
if (string.IsNullOrEmpty(cereal)) { if (string.IsNullOrEmpty(cereal)) {
return null; IAssembler asm = AssemblerInfo.GetAssembler(id);
return asm.GetDefaultConfig();
} }
JavaScriptSerializer ser = new JavaScriptSerializer(); JavaScriptSerializer ser = new JavaScriptSerializer();