From 7fb5342de22e01b5eb397e3974011ed34269bc1d Mon Sep 17 00:00:00 2001 From: SathishKumar1986 Date: Mon, 17 Jun 2019 21:28:07 -0400 Subject: [PATCH] there is spike in crash recently in this statement so as recommended use safe unwrap instead of newValue == nil --- JSONWebToken/JSONWebToken.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/JSONWebToken/JSONWebToken.swift b/JSONWebToken/JSONWebToken.swift index 2b5d984..fc00699 100644 --- a/JSONWebToken/JSONWebToken.swift +++ b/JSONWebToken/JSONWebToken.swift @@ -56,10 +56,10 @@ public struct JSONWebToken { } } set { - if newValue == nil || newValue is NSNull { - jsonPayload.removeValue(forKey: key) - } else { + if let newValue = newValue { jsonPayload[key] = newValue + } else { + jsonPayload.removeValue(forKey: key) } } }