From aec93b0f36f2036f5db17c18cd6ecc1c3b381943 Mon Sep 17 00:00:00 2001 From: Bruno Muniz Azevedo Filho <bruno@elixxir.io> Date: Wed, 20 Jul 2022 00:47:33 -0300 Subject: [PATCH] Fixes crash from restoring empty string as phone --- Sources/Integration/Session/Session.swift | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Sources/Integration/Session/Session.swift b/Sources/Integration/Session/Session.swift index 10617576..f85a6c6f 100644 --- a/Sources/Integration/Session/Session.swift +++ b/Sources/Integration/Session/Session.swift @@ -130,11 +130,17 @@ public final class Session: SessionType { let params = try! JSONDecoder().decode(BackupParameters.self, from: Data(report.parameters.utf8)) username = params.username - phone = params.phone - email = params.email + + if let paramsPhone = params.phone, !paramsPhone.isEmpty { + phone = paramsPhone + } + + if let paramsEmail = params.email, !paramsEmail.isEmpty { + email = paramsEmail + } } - print(report.parameters) + print("^^^ \(report.parameters)") guard username!.isEmpty == false else { fatalError("Trying to restore an account that has no username") -- GitLab