Skip to content

Commit

Permalink
remover erro ao descarregar camada
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro-mar committed Aug 14, 2024
1 parent d360c20 commit 4519ab6
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,16 +303,12 @@ unsetChapter = () => {
for (let projectName in projectSettings) {
for (let lote of projectSettings[projectName].lotes) {
for (let style of lote.styles) {
try {
map.removeLayer(style.id)
} catch (error) {

if (map.getLayer(style.id)) { // Verifica se a camada existe
map.removeLayer(style.id);
}
}
try {
map.removeSource(lote.name)
} catch (error) {

if (map.getSource(lote.name)) { // Verifica se a fonte existe
map.removeSource(lote.name);
}
}
}
Expand Down

0 comments on commit 4519ab6

Please sign in to comment.