From e73a0b8045f4f427d4ffb0c0579c1cd4813f5928 Mon Sep 17 00:00:00 2001 From: Dan Loman Date: Fri, 21 Feb 2020 23:08:40 -0800 Subject: [PATCH] [crash fix] Allow Optional values when encoding --- Sources/Leaf/LeafEncoder.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Leaf/LeafEncoder.swift b/Sources/Leaf/LeafEncoder.swift index 5a1db78..b7ef1fb 100644 --- a/Sources/Leaf/LeafEncoder.swift +++ b/Sources/Leaf/LeafEncoder.swift @@ -99,7 +99,7 @@ private final class SingleValueContainer: SingleValueEncodingContainer, _Contain } else { let encoder = _Encoder(codingPath: self.codingPath) try value.encode(to: encoder) - self.data = encoder.container!.data! + self.data = encoder.container!.data } } } @@ -139,7 +139,7 @@ private final class KeyedContainer: KeyedEncodingContainerProtocol, _Contai } else { let encoder = _Encoder(codingPath: codingPath + [key]) try value.encode(to: encoder) - self.dictionary[key.stringValue] = encoder.container!.data! + self.dictionary[key.stringValue] = encoder.container!.data } }