From 236d64ec144e929afd59c69ddc685849c46e9c86 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Wed, 11 Sep 2013 12:23:57 +0200 Subject: [PATCH] symbolizersToXML: Do not assume tagcontent has a value Fixes #297 Includes testcase --- lib/carto/tree/definition.js | 2 +- test/errorhandling/issue297.mss | 4 ++++ test/errorhandling/issue297.result | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 test/errorhandling/issue297.mss create mode 100644 test/errorhandling/issue297.result diff --git a/lib/carto/tree/definition.js b/lib/carto/tree/definition.js index c2e7305..fb23eea 100644 --- a/lib/carto/tree/definition.js +++ b/lib/carto/tree/definition.js @@ -140,7 +140,7 @@ tree.Definition.prototype.symbolizersToXML = function(env, symbolizers, zoom) { if (selfclosing) { xml += '/>\n'; } else { - if (tagcontent.indexOf('<') != -1) { + if (tagcontent && tagcontent.indexOf('<') != -1) { xml += '>' + tagcontent + '\n'; } else { xml += '>\n'; diff --git a/test/errorhandling/issue297.mss b/test/errorhandling/issue297.mss new file mode 100644 index 0000000..a406488 --- /dev/null +++ b/test/errorhandling/issue297.mss @@ -0,0 +1,4 @@ +#t { + text-name: invalid; + text-face-name: "Dejagnu"; +} diff --git a/test/errorhandling/issue297.result b/test/errorhandling/issue297.result new file mode 100644 index 0000000..422c58e --- /dev/null +++ b/test/errorhandling/issue297.result @@ -0,0 +1 @@ +issue297.mss:2:2 Invalid value for text-name, the type expression is expected. invalid (of type keyword) was given.