diff --git a/packages/overlayscrollbars-ngx/src/overlayscrollbars.component.ts b/packages/overlayscrollbars-ngx/src/overlayscrollbars.component.ts index 77c0ff36..df9f5405 100644 --- a/packages/overlayscrollbars-ngx/src/overlayscrollbars.component.ts +++ b/packages/overlayscrollbars-ngx/src/overlayscrollbars.component.ts @@ -97,7 +97,7 @@ export class OverlayScrollbarsComponent implements OnDestroy, AfterViewInit { } ngOnDestroy() { - this.osDirective?.osInstance()!.destroy(); + this.osDirective?.osInstance()?.destroy(); } mergeEvents(originalEvents: OverlayScrollbarsComponent['events']) {