diff --git a/src/mapnik_palette.cpp b/src/mapnik_palette.cpp index 111cf54e2b..9fec49c2aa 100644 --- a/src/mapnik_palette.cpp +++ b/src/mapnik_palette.cpp @@ -47,7 +47,7 @@ NAN_METHOD(Palette::New) { } if (info.Length() >= 2) { if (info[1]->IsString()) { - std::string obj = std::string(TOSTR(info[1])); + std::string obj = TOSTR(info[1]); if (obj == "rgb") { type = mapnik::rgba_palette::PALETTE_RGB; diff --git a/test/palette.test.js b/test/palette.test.js index 6294c65871..5a58a65dba 100644 --- a/test/palette.test.js +++ b/test/palette.test.js @@ -16,6 +16,7 @@ describe('mapnik.Palette ', function() { assert.throws(function() { new mapnik.Palette(); }); assert.throws(function() { new mapnik.Palette(1); }); assert.throws(function() { new mapnik.Palette('foo'); }); + assert.throws(function() { new mapnik.Palette(new Buffer('\xff\x00\xff\xff\xff\xff','ascii'), 'bogus') }); assert.throws(function() { new mapnik.Palette(new Buffer('\x01\x02\x03')); }, (/invalid palette length/));