From 0352ea347c53f2eabc73cd4a4439d035fa38edc9 Mon Sep 17 00:00:00 2001 From: Yonas Kolb Date: Thu, 24 Aug 2017 14:37:08 +0200 Subject: [PATCH] fix decoding empty SettingPreset --- Sources/ProjectSpec/Decoding.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/ProjectSpec/Decoding.swift b/Sources/ProjectSpec/Decoding.swift index ad448f020..7f53ffc05 100644 --- a/Sources/ProjectSpec/Decoding.swift +++ b/Sources/ProjectSpec/Decoding.swift @@ -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