From 35e7c181500ff7b13a712f9c5ecfffc7520499cb Mon Sep 17 00:00:00 2001 From: Frank Rotermund Date: Tue, 6 Feb 2024 08:16:42 +0100 Subject: [PATCH] MESSENGER-5740 fix double notes rooms on connection erros --- .../PersonalNotesDefaultService.swift | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/bwi/PersonalNotes/PersonalNotesDefaultService.swift b/bwi/PersonalNotes/PersonalNotesDefaultService.swift index b11dd4f6f..a6a7519e1 100644 --- a/bwi/PersonalNotes/PersonalNotesDefaultService.swift +++ b/bwi/PersonalNotes/PersonalNotesDefaultService.swift @@ -102,11 +102,19 @@ extension PersonalNotesDefaultService : PersonalNotesService { func createPersonalNotesRoomIfNeeded() { self.fetchRoomID() { (roomId, error) in - if let mxerror = error as? MXError { - if let errcode = mxerror.userInfo["errcode"] as? String { - if errcode != kMXErrCodeStringNotFound { - // request error, don't create room - return + + // bwi #5740 don't create room after connection error that is not translated to mxerror + if let error = error { + if MXError.isMXError(error) { + if let mxError = MXError(nsError: error) { + if let errcode = mxError.userInfo["errcode"] as? String { + if errcode != kMXErrCodeStringNotFound { + // request error, don't create room + return + } + } else { + return + } } } else { return