From 914202b269d7f766a1650dd729c862aeac07de29 Mon Sep 17 00:00:00 2001 From: Roi Date: Tue, 16 Oct 2018 14:58:35 +0200 Subject: [PATCH] Avoid crash unwrapping optional date fields --- Sources/parseRows.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/parseRows.swift b/Sources/parseRows.swift index 2e6c527..3ee2410 100644 --- a/Sources/parseRows.swift +++ b/Sources/parseRows.swift @@ -61,7 +61,9 @@ extension PostgresStORM { let output = result.getFieldString(tupleIndex: x, fieldIndex: f) let formatter = DateFormatter() formatter.dateFormat = "yyyy/MM/dd hh:mm Z" - params[result.fieldName(index: f)!] = formatter.date(from: output!) + if let output = output { + params[result.fieldName(index: f)!] = formatter.date(from: output) + } // time // timestamp