Skip to content

Commit

Permalink
Fix an issue that would create an extra tab when leaving a malicious …
Browse files Browse the repository at this point in the history
…site and only one tab is in the stack
  • Loading branch information
alessandroboron committed Jan 30, 2025
1 parent 1d8ac73 commit 4dc692e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions DuckDuckGo/TabManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,13 @@ class TabManager {
}

func replaceTab(at index: Int, withNewTab newTab: Tab) {
model.remove(at: index)
model.insert(tab: newTab, at: index)
// Removing a Tab automatically inserts a new one if tabs are empty. Hence add a new one only if needed
if model.tabs.count == 1 {
model.remove(at: index)
} else {
model.remove(at: index)
model.insert(tab: newTab, at: index)
}
save()
}

Expand Down

0 comments on commit 4dc692e

Please sign in to comment.