Closed Bug 507648 Opened 16 years ago Closed 16 years ago

Running "format" with an unsaved file results in TypeError

Categories

(Skywriter Graveyard :: Editor, defect, P4)

x86
macOS

Tracking

(Not tracked)

RESOLVED FIXED
Future

People

(Reporter: ryan, Unassigned)

References

()

Details

User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1 Build Identifier: 0.3.0 Strategic Stratus If a file has not been saved (has no type), an error is shown when the format command is run from the cmd line. Reproducible: Always Steps to Reproduce: 1. Load http://bespin.mozilla.com/editor.html 2. (optionally) Type some text into the empty editor 3. Go to Cmd line 4. Type format, hit enter Actual Results: See error "TypeError:_7e1 is undefined" Expected Results: Nothing, or useful error message I don't have an Hg repo set up yet: diff -r f1531f7e40a2 frontend/js/bespin/editor/formatter.js --- a/frontend/js/bespin/editor/formatter.js Thu Jul 30 23:14:11 2009 -0400 +++ b/frontend/js/bespin/editor/formatter.js Fri Jul 31 07:43:38 2009 -0700 @@ -116,7 +116,10 @@ dojo.declare("bespin.editor.formatter.API", null, { setLanguage: function(language) { - switch (language.toLowerCase()) { + if (dojo.isString(language)) { + language = language.toLowerCase(); + } + switch (language) { case 'css': case 'javascript': case 'js':
Ryan, Thanks so much! This has been added to tip in changeset d4bcd0855e14 Cheers, Dion
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Priority: -- → P4
Target Milestone: --- → Future
You need to log in before you can comment on or make changes to this bug.