diff --git a/projects/ngx-openlayers/src/lib/sources/source.component.ts b/projects/ngx-openlayers/src/lib/sources/source.component.ts index bc03454c..c036a653 100644 --- a/projects/ngx-openlayers/src/lib/sources/source.component.ts +++ b/projects/ngx-openlayers/src/lib/sources/source.component.ts @@ -14,7 +14,7 @@ export class SourceComponent implements OnDestroy { constructor(protected host: LayerComponent, protected raster?: SourceRasterComponent) {} ngOnDestroy() { - if (this.host) { + if (this.host && this.host.instance) { this.host.instance.setSource(null); }