Skip to content

Commit

Permalink
Prompt for new editor if getting the saved one fails.
Browse files Browse the repository at this point in the history
Fixes #1386
  • Loading branch information
arantius committed Aug 19, 2011
1 parent 04ef8ae commit 4ed1c55
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions content/utils.js
Expand Up @@ -99,13 +99,18 @@ function GM_getEditor(change) {
if (!change && editorPath) {
GM_log("Found saved editor preference: " + editorPath);

var editor = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
editor.followLinks = true;
editor.initWithPath(editorPath);
var editor;
try {
editor = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
editor.followLinks = true;
editor.initWithPath(editorPath);
} catch (e) {
editor = null;
}

// make sure the editor preference is still valid
if (editor.exists() && editor.isExecutable()) {
if (editor && editor.exists() && editor.isExecutable()) {
return editor;
} else {
GM_log("Editor preference either does not exist or is not executable");
Expand Down

0 comments on commit 4ed1c55

Please sign in to comment.