From 3e1c0f09b6e174706d31a36f71f8319b92a16983 Mon Sep 17 00:00:00 2001 From: Nazar Alwi Date: Mon, 12 Aug 2024 13:05:01 +0700 Subject: [PATCH] Fix crash due to inconsistency between the data source and the tableview update --- .../RecordingsClient/FolderViewController.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Recordings-controller-owned-networking/RecordingsClient/FolderViewController.swift b/Recordings-controller-owned-networking/RecordingsClient/FolderViewController.swift index b463293..3ce08f9 100644 --- a/Recordings-controller-owned-networking/RecordingsClient/FolderViewController.swift +++ b/Recordings-controller-owned-networking/RecordingsClient/FolderViewController.swift @@ -148,8 +148,10 @@ class FolderViewController: UITableViewController, RecordViewControllerDelegate } func insert(item: Item) { + self.tableView.beginUpdates() self.folder.contents.append(item) self.tableView.insertRows(at: [IndexPath(row: self.folder.contents.endIndex-1, section: 0)], with: .automatic) + self.tableView.endUpdates() } override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {