Skip to content

Commit

Permalink
fix: app crash in random times
Browse files Browse the repository at this point in the history
  • Loading branch information
mironiasty committed Dec 20, 2023
1 parent 75bc8cb commit 13c7833
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/turbo/ios/RNSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,12 @@ class RNSession: NSObject {
func unregisterVisitableView(view: RNSessionSubscriber) {
let wasTopMostView = visitableViews.last?.id == view.id

let viewIdx = visitableViews.lastIndex(where: {
view.id == $0.id
})
visitableViews.remove(at: viewIdx!)
if (!visitableViews.isEmpty) {
let viewIdx = visitableViews.lastIndex(where: {
view.id == $0.id
})
visitableViews.remove(at: viewIdx!)
}

// The new top-most view is not registered when the previous top-most view is a modal
if (wasTopMostView) {
Expand Down

0 comments on commit 13c7833

Please sign in to comment.