Skip to content

Commit 3395df1

Browse files
committed
🔀 Fixed code flow control
1 parent f5ad559 commit 3395df1

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

swift-sdk/Internal/AnonymousUserManager.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,7 @@ public class AnonymousUserManager: AnonymousUserManagerProtocol {
243243

244244
// Stores all other event data
245245
private func processAndStoreEvent(type: String, data: [AnyHashable: Any], shouldOverWrite: Bool) {
246-
var eventsDataObjects: [[AnyHashable: Any]] = []
247-
248-
if let anonymousUserEvents = localStorage.anonymousUserEvents {
249-
eventsDataObjects.append(contentsOf: anonymousUserEvents)
250-
}
246+
var eventsDataObjects: [[AnyHashable: Any]] = localStorage.anonymousUserEvents ?? []
251247

252248
if shouldOverWrite, let indexToUpdate = eventsDataObjects.firstIndex(where: { $0[JsonKey.eventType] as? String == type }) {
253249
let dataToUpdate = eventsDataObjects[indexToUpdate]

0 commit comments

Comments
 (0)