From 540b77f3dc47e8a5a83584747a88eb6f476ac247 Mon Sep 17 00:00:00 2001 From: Amitay Molko Date: Thu, 6 Jan 2022 08:49:29 +0200 Subject: [PATCH] feat(ios): fix crash on decrypt --- ios/RSAECNative.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ios/RSAECNative.swift b/ios/RSAECNative.swift index 842b65d..faae259 100644 --- a/ios/RSAECNative.swift +++ b/ios/RSAECNative.swift @@ -367,6 +367,9 @@ class RSAECNative: NSObject { public func decrypt(message: String) -> String? { guard let data = Data(base64Encoded: message, options: .ignoreUnknownCharacters) else { return nil } let decrypted = self._decrypt(data: data) + if (decrypted == nil) { + return nil + } return String(data: decrypted!, encoding: String.Encoding.utf8) }