Handle NULL exception for folder index when retrieving folder modes
Categories
(Thunderbird :: Folder and Message Lists, task)
Tracking
(thunderbird_esr78 unaffected)
Tracking | Status | |
---|---|---|
thunderbird_esr78 | --- | unaffected |
People
(Reporter: aleca, Assigned: aleca)
References
Details
Attachments
(1 file)
(deleted),
patch
|
mkmelin
:
review+
|
Details | Diff | Splinter Review |
As per alta88 comment:
@@ -592,17 +590,19 @@ var gFolderTreeView = {
* view. Defaults to false.
* @returns true if the folder selection was successful, false if it failed
* (probably because the folder isn't in the view at all)
*/
selectFolder(aFolder, aForceSelect = false) {
// "this" inside the nested function refers to the function...
// Also note that openIfNot is recursive.
let tree = this;
- let folderTreeMode = this._modes[this._mode];
- let mode = this.getModeForIndex(this.getIndexOfFolder(aFolder));
- let folderTreeMode = this._modes[mode];
If you read the comment for getIndexOfFolder() you will see it can return null, and getModeForIndex() does not handle that. Tabs as folders manifest this. Please follow up, thanks.
Assignee | ||
Comment 1•4 years ago
|
||
Comment 2•4 years ago
|
||
Assignee | ||
Updated•4 years ago
|
There are other callers, null is not the only possibility, so that is a wrong and insufficient way to test for the validity of a index to be used for 0 based array access.
Assignee | ||
Comment 4•4 years ago
|
||
Isn't this method only returning an INT or NULL?
https://searchfox.org/comm-central/rev/2ebf654a54e51c83febc5a891482f3419ebe3fa2/mail/base/content/folderPane.js#662-669
The getModeForIndex()
method only expects an index pointer, or a NULL in case the the getIndexOfFolder()
method is used.
Can you point out other scenarios in the code?
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/74e427ca4c3b
Handle NULL exception for folder index when retrieving folder modes. r=mkmelin
Description
•