Cannot call method 'indexOf' of undefined #297

Closed
strk opened this Issue Sep 11, 2013 · 3 comments

1 participant

@strk

From CartoDB/Windshaft-cartodb#81:

This style:

#sample { text-name: cartodb_id; text-face-name: "Dejagnu"; }

Triggers a js error deep in carto parser:

TypeError: Cannot call method 'indexOf' of undefined
    at Definition.tree.Definition.symbolizersToXML (/home/src/node/modules/carto/lib/carto/tree/definition.js:143:28)
    at Definition.tree.Definition.toXML (/home/src/node/modules/carto/lib/carto/tree/definition.js:198:29)
    at /home/src/node/modules/carto/lib/carto/tree/style.js:28:27
    at Array.map (native)
    at Object.tree.StyleXML (/home/src/node/modules/carto/lib/carto/tree/style.js:27:29)
    at Renderer.render (/home/src/node/modules/carto/lib/carto/renderer.js:133:39)

The offending line calls indexOf on the tagcontent variable, which is evidently undefined. Happens in both master and 0.9.3.

Here's a link to the relevant code in tag 0.9.4, for reference:
https://github.com/mapbox/carto/blob/v0.9.4/lib/carto/tree/definition.js#L113

@strk

I've a patch. Wanted to write a testcase for it but the "errorhandling.test.js" only checks for an error being thrown, not checking the actual message. Should that suite be improved ?

@strk

nevermind, I see the tester is actually smart enough,only needed to provide a .result file :) expect a pull request shortly

@strk strk added a commit to strk/carto that referenced this issue Sep 11, 2013
@strk strk symbolizersToXML: Do not assume tagcontent has a value
Fixes #297

Includes testcase
236d64e
@strk

Continues to #298

@strk strk closed this Sep 11, 2013
@strk strk added a commit to strk/carto that referenced this issue Sep 12, 2013
@strk strk Integrate mml parsing test for issue #297 ba51c74
@strk strk referenced this issue in CartoDB/grainstore Sep 12, 2013
Closed

Cannot call method 'indexOf' of undefined #62

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment