mirror of
https://github.com/maputnik/editor.git
synced 2026-08-26 15:07:41 +00:00
Ensure editor does not crash with raster layers
This commit is contained in:
@@ -31,12 +31,14 @@ export class ApiStyleStore {
|
||||
connection.onmessage = e => {
|
||||
if(!e.data) return
|
||||
console.log('Received style update from API')
|
||||
let parsedStyle = style.emptyStyle
|
||||
try {
|
||||
const updatedStyle = style.ensureStyleValidity(JSON.parse(e.data))
|
||||
this.onLocalStyleChange(updatedStyle)
|
||||
parsedStyle = JSON.parse(e.data)
|
||||
} catch(err) {
|
||||
console.error('Could not parse local style')
|
||||
console.error(err)
|
||||
}
|
||||
const updatedStyle = style.ensureStyleValidity(parsedStyle)
|
||||
this.onLocalStyleChange(updatedStyle)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user