handled a possible exception

This commit is contained in:
ceikry 2021-08-02 11:24:21 -05:00
parent d59e8decc5
commit dd5e3f998d

View file

@ -29,11 +29,15 @@ object DataStore {
val obj = JSONObject()
obj["lastConfigPath"] = LastConfigPath
Logger.logInfo("Saving user preferences...")
FileWriter(savePath.toString() + File.separator + "settings.json").use {
it.write(obj.toJSONString())
it.flush()
it.close()
Logger.logInfo("User preferences saved!")
try {
FileWriter(savePath.toString() + File.separator + "settings.json").use {
it.write(obj.toJSONString())
it.flush()
it.close()
Logger.logInfo("User preferences saved!")
}
} catch (exception: Exception){
exception.printStackTrace()
}
}
}