@@ -251,7 +251,7 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
251251
252252
253253 public get displayContainer ( ) : HTMLElement | undefined {
254- return this . dc . instance . _viewContainer . element . nativeElement ;
254+ return this . dc ? .instance ? ._viewContainer ? .element ? .nativeElement ;
255255 }
256256
257257 public get virtualHelper ( ) {
@@ -353,11 +353,11 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
353353 protected removeScrollEventListeners ( ) {
354354 if ( this . igxForScrollOrientation === 'horizontal' ) {
355355 this . _zone . runOutsideAngular ( ( ) =>
356- this . scrollComponent . nativeElement . removeEventListener ( 'scroll' , this . func )
356+ this . scrollComponent ? .nativeElement ? .removeEventListener ( 'scroll' , this . func )
357357 ) ;
358358 } else {
359359 this . _zone . runOutsideAngular ( ( ) =>
360- this . scrollComponent . nativeElement . removeEventListener ( 'scroll' , this . verticalScrollHandler )
360+ this . scrollComponent ? .nativeElement ? .removeEventListener ( 'scroll' , this . verticalScrollHandler )
361361 ) ;
362362 }
363363 }
@@ -698,7 +698,7 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
698698 * ```
699699 */
700700 public getScroll ( ) {
701- return this . scrollComponent . nativeElement ;
701+ return this . scrollComponent ? .nativeElement ;
702702 }
703703 /**
704704 * Returns the size of the element at the specified index.
0 commit comments