Ensure editor does not crash with raster layers

This commit is contained in:
Lukas Martinelli
2017-01-05 21:05:34 +01:00
parent 08854cd88f
commit e7b11d8bc9
4 changed files with 8 additions and 5 deletions
+5 -3
View File
@@ -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)
}
}