From ed466dd124d9cf344ee47950fd915b17c5f3b727 Mon Sep 17 00:00:00 2001 From: Alessandro Castellani Date: Sat, 25 Sep 2021 13:05:08 +0300 Subject: [PATCH] Bug 1732231 - Prevent updating the folderTree.json if the folder pane is empty or not initialized. r=mkmelin Differential Revision: https://phabricator.services.mozilla.com/D126591 --HG-- extra : amend_source : dc6b13750a1b1b3efaf0fafbd5d9153c065be749 --- mail/base/content/folderPane.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mail/base/content/folderPane.js b/mail/base/content/folderPane.js index f0cdaea821..c65ddbd599 100644 --- a/mail/base/content/folderPane.js +++ b/mail/base/content/folderPane.js @@ -220,8 +220,10 @@ var gFolderTreeView = { // Remove our listener MailServices.mailSession.RemoveFolderListener(this); - if (filename) { - // Write out our json file... + // Update the JSON file only if we have a file, the folder tree was inited + // and we have at least one available folder in order to avoid overriding + // existing data in case the UI is broken on startup. + if (filename && this.isInited && this.rowCount) { let data = { open: this._persistOpenMap, colors: this._persistColorMap,