From 9f11fd20a2c9339215de1dcc2cbe6c5996b9af22 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Mon, 11 Sep 2017 19:30:21 -0700 Subject: [PATCH] Fix exception during startup if configuration is missing. --- .../main/kotlin/org/nwapw/abacus/fx/ExtendedConfiguration.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fx/src/main/kotlin/org/nwapw/abacus/fx/ExtendedConfiguration.kt b/fx/src/main/kotlin/org/nwapw/abacus/fx/ExtendedConfiguration.kt index 9c0b152..1cfaf87 100644 --- a/fx/src/main/kotlin/org/nwapw/abacus/fx/ExtendedConfiguration.kt +++ b/fx/src/main/kotlin/org/nwapw/abacus/fx/ExtendedConfiguration.kt @@ -45,7 +45,9 @@ class ExtendedConfiguration(var computationDelay: Double = 0.0, * @param tomlFile the file from disk to load. */ constructor(tomlFile: File) : this() { - copyFrom(Toml(DEFAULT_TOML_READER).read(tomlFile).to(ExtendedConfiguration::class.java)) + val toml = Toml(DEFAULT_TOML_READER) + if(tomlFile.exists()) toml.read(tomlFile) + copyFrom(toml.to(ExtendedConfiguration::class.java)) } /**