diff --git a/plugin.gd b/plugin.gd index 7c14d58..db0e911 100644 --- a/plugin.gd +++ b/plugin.gd @@ -160,16 +160,17 @@ func exportZip(): var modcfg = ConfigFile.new() modcfg.load(modCfgPath) - # Store the remaps defined in the mod.txt remaps section - for src in modcfg.get_section_keys("remaps"): - var remapCfg = ConfigFile.new() - var override = modcfg.get_value("remaps", src) - override = compiledRemaps.get(override, override) - remapCfg.set_value("remap", "path", override) - zipAddBuf(zip, src + ".remap", remapCfg.encode_to_text().to_utf8_buffer()) - - # Remove the remaps section - modcfg.erase_section("remaps") + if modcfg.has_section("remaps"): + # Store the remaps defined in the mod.txt remaps section + for src in modcfg.get_section_keys("remaps"): + var remapCfg = ConfigFile.new() + var override = modcfg.get_value("remaps", src) + override = compiledRemaps.get(override, override) + remapCfg.set_value("remap", "path", override) + zipAddBuf(zip, src + ".remap", remapCfg.encode_to_text().to_utf8_buffer()) + + # Remove the remaps section + modcfg.erase_section("remaps") # Store the mod.txt zipAddBuf(zip, "mod.txt", modcfg.encode_to_text().to_utf8_buffer())