fix decoding empty SettingPreset

This commit is contained in:
Yonas Kolb
2017-08-24 14:37:08 +02:00
parent f75e7f8140
commit 0352ea347c
+4
View File
@@ -53,6 +53,10 @@ extension JSONObjectConvertible {
public init(path: Path) throws {
let content: String = try path.read()
if content == "" {
try self.init(jsonDictionary: [:])
return
}
let yaml = try Yams.load(yaml: content)
guard let jsonDictionary = yaml as? JSONDictionary else {
throw JSONUtilsError.fileNotAJSONDictionary