@@ -270,7 +270,7 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
270270
271271
272272 public get displayContainer ( ) : HTMLElement | undefined {
273- return this . dc . instance . _viewContainer . element . nativeElement ;
273+ return this . dc ? .instance ? ._viewContainer ? .element ? .nativeElement ;
274274 }
275275
276276 public get virtualHelper ( ) {
@@ -372,11 +372,11 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
372372 protected removeScrollEventListeners ( ) {
373373 if ( this . igxForScrollOrientation === 'horizontal' ) {
374374 this . _zone . runOutsideAngular ( ( ) =>
375- this . scrollComponent . nativeElement . removeEventListener ( 'scroll' , this . func )
375+ this . scrollComponent ? .nativeElement ? .removeEventListener ( 'scroll' , this . func )
376376 ) ;
377377 } else {
378378 this . _zone . runOutsideAngular ( ( ) =>
379- this . scrollComponent . nativeElement . removeEventListener ( 'scroll' , this . verticalScrollHandler )
379+ this . scrollComponent ? .nativeElement ? .removeEventListener ( 'scroll' , this . verticalScrollHandler )
380380 ) ;
381381 }
382382 }
@@ -717,7 +717,7 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
717717 * ```
718718 */
719719 public getScroll ( ) {
720- return this . scrollComponent . nativeElement ;
720+ return this . scrollComponent ? .nativeElement ;
721721 }
722722 /**
723723 * Returns the size of the element at the specified index.
0 commit comments