mapbox / carto

fast CSS-like map stylesheets
https://cartocss.readthedocs.io/
Apache License 2.0
652 stars 129 forks source link

TypeError: Cannot call method 'replace' of undefined #430

Closed strk closed 8 years ago

strk commented 8 years ago

Attempts to render the following MML results in an exception being thrown. I'm not sure if exception throwing is tolerated (I remember someone once told me carto was not supposed to throw?)

This happens as of commit 21be5fb8d5643d70ff48a1c3249d8b4f9f2ddb09 (current master)

{
    "srs":"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
    "Stylesheet": [
      {"id":"tile_style"}
    ],
    "Layer": [{
      "clear_label_cache": false,
      "queryable": false,
      "maximum_scale_denominator": 1.7976931348623157e+308,
      "minimum_scale_denominator":0,
      "datasource": {
        "type":"vector"
      },
      "styles": ["layer"],
      "srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
      "active": true,
      "name": "layer"
    }]
}
strk commented 8 years ago

I think the problem is in the missing data element in the Stylesheet only element.

strk commented 8 years ago

I would provide a testcase but I cannot due to #429

nebulon42 commented 8 years ago

Yes, that's it. The problem is actually in https://github.com/mapbox/carto/blob/master/lib/carto/renderer.js#L93 where the parser is called with s.data, which is undefined. No relation to the mentioned commit though, as it happened also before.

nebulon42 commented 8 years ago

Related to #367.