Permalink
Browse files

Quick bugfix for crashes while scanning files

The built-in regexps fail with some JavaScript files in my projects such
as ckeditor's plugins/stylescombo/styles/default.js. This avoids the
crash but it warrants further investigation when time allows - it's not
immediately obvious why that regexp should be matching those lines at
all.
  • Loading branch information...
1 parent 000b087 commit 119db6ad158adcdc3f1a3ac260456e4476090465 @acdha acdha committed Jan 5, 2010
Showing with 12 additions and 1 deletion.
  1. +12 −1 Support/todo.rb
View
@@ -84,7 +84,18 @@ def TextMate.file_link (file, line = 0)
:rendered => '',
:index => tag[:matches].length
}
- part = $1
+
+ # Some of the built-in filters produce failures on some of our files
+ # such as the CKEditor ckeditor/plugins/stylescombo/styles/default.js.
+ # We'll skip these to avoid crashing but this appears to indicate a
+ # deeper bug:
+ #
+ # if $1 == nil then
+ # STDERR.puts("<p style=\"color: red; font-family:monospace; white-space: pre;\">TODO.tmbundle bug: #{tag[:label]} matched nil at #{file}:#{io.lineno}:\n\tRegexp: " + html_escape(tag[:regexp]) + "\n\t Value: " + html_escape(match[:content]) + "\n\n")
+ # end
+
+ part = $1 or next
+
if tag[:label] == "RADAR" then
url, display = "http://openradar.appspot.com/" + $2, "rdar://" + $2
match[:match] = html_escape($1) + "<a href=\"" + url + "\" target=\"_blank\">" + html_escape(display) + "</a>" + html_escape($3)

0 comments on commit 119db6a

Please sign in to comment.