Added additional guard

As checking the key name is 'openmaptiles' isn't a guarantee
This commit is contained in:
orangemug 2018-02-01 22:00:26 +00:00
parent 5ce57d0803
commit 7d5927bbc8

View file

@ -57,6 +57,7 @@ function indexOfLayer(layers, layerId) {
function replaceAccessToken(mapStyle) {
const omtSource = mapStyle.sources.openmaptiles
if(!omtSource) return mapStyle
if(!omtSource.hasOwnProperty("url")) return mapStyle
const metadata = mapStyle.metadata || {}
const accessToken = metadata['maputnik:openmaptiles_access_token'] || tokens.openmaptiles