From b52df3ca52fe396ba3f71ef8f3f37b8225133a66 Mon Sep 17 00:00:00 2001 From: Shad Downey Date: Fri, 27 Jul 2012 14:07:48 -0700 Subject: [PATCH] Cast tick label to string prior to `replace` call In the edge case that an actual integer, or other non-string, is passed as a label, it must be cast to String before `replace` can safely be called. --- jquery.flot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.flot.js b/jquery.flot.js index 453ebc7..66c5aed 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -943,7 +943,7 @@ // accept various kinds of newlines, including HTML ones // (you can actually split directly on regexps in Javascript, // but IE is unfortunately broken) - var lines = t.label.replace(/
|\r\n|\r/g, "\n").split("\n"); + var lines = String(t.label).replace(/
|\r\n|\r/g, "\n").split("\n"); for (var j = 0; j < lines.length; ++j) { var line = { text: lines[j] }, m = ctx.measureText(line.text);