mirror of
https://github.com/rn10950/RetroZilla.git
synced 2024-11-10 18:00:15 +01:00
pref/main: _getDownloadsFolder() and fileLocator.get() can throw, wrap them with try-catch block
This commit is contained in:
parent
d1a5d94f4b
commit
8444083c28
@ -307,10 +307,12 @@ var gMainPane = {
|
||||
*/
|
||||
_folderToIndex: function (aFolder)
|
||||
{
|
||||
try {
|
||||
if (!aFolder || aFolder.equals(this._getDownloadsFolder("Desktop")))
|
||||
return 0;
|
||||
else if (aFolder.equals(this._getDownloadsFolder("Downloads")))
|
||||
return 1;
|
||||
} catch(e) {}
|
||||
return 2;
|
||||
},
|
||||
|
||||
@ -326,8 +328,13 @@ var gMainPane = {
|
||||
{
|
||||
var fileLocator = Components.classes["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Components.interfaces.nsIProperties);
|
||||
var dir = fileLocator.get(this._getSpecialFolderKey(aFolder),
|
||||
var dir;
|
||||
try {
|
||||
dir = fileLocator.get(this._getSpecialFolderKey(aFolder),
|
||||
Components.interfaces.nsILocalFile);
|
||||
} catch(e) {
|
||||
dir = aFolder;
|
||||
}
|
||||
if (aFolder != "Desktop")
|
||||
dir.append("My Downloads"); // XXX l12y!
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user