Skip to content

Commit

Permalink
Fixed crash when removing block items.
Browse files Browse the repository at this point in the history
  • Loading branch information
tladesignz committed Jun 5, 2024
1 parent 33056a9 commit ed440bd
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Orbot/ContentBlocker/ContentBlockerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,22 @@ class ContentBlockerViewController: BaseFormViewController, BlockerViewControlle
self?.open(index)
}

$0.tag = String(index)

$0.cell.textLabel?.numberOfLines = 0

let font = $0.cell.textLabel?.font ?? UIFont.systemFont(ofSize: UIFont.buttonFontSize)
$0.cell.textLabel?.font = UIFont(name: font.familyName, size: font.pointSize - 3)
}
.cellUpdate({ cell, row in
let index = Int(string: row.tag ?? "0") ?? 0
row.title = BlockList.shared[index].description
let item: BlockItem?

if let index = row.indexPath?.row, index < BlockList.shared.count {
item = BlockList.shared[index]
}
else {
item = nil
}

row.title = item?.description

cell.textLabel?.textAlignment = .natural
})
Expand Down

0 comments on commit ed440bd

Please sign in to comment.