Skip to content
This repository was archived by the owner on Jun 22, 2020. It is now read-only.

Commit c8b082a

Browse files
committed
fix: null pointer when source is null
1 parent ab37306 commit c8b082a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

projects/table-builder/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@angular-ru/ng-table-builder",
3-
"version": "0.30.0",
3+
"version": "0.31.0",
44
"license": "MIT",
55
"bugs": {
66
"url": "https://github.com/Angular-RU/ng-table-builder/issues"

projects/table-builder/src/lib/table/directives/virtual-for.directive.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ export class VirtualForDirective implements OnDestroy {
3838
this.createNewNodes(indexes);
3939
}
4040

41+
private get sourceRef(): TableRow[] {
42+
return this._source || [];
43+
}
44+
4145
public ngOnDestroy(): void {
4246
this.view.clear();
4347
window.cancelAnimationFrame(this.createFrameId);
@@ -70,7 +74,7 @@ export class VirtualForDirective implements OnDestroy {
7074
}
7175

7276
private createEmbeddedViewByIndex(index: VirtualIndex): void {
73-
const row: TableRow = this._source[index.position];
77+
const row: TableRow = this.sourceRef[index.position];
7478
const virtualRef: InternalVirtualRef = this.cache.get(index.position);
7579

7680
if (virtualRef) {

0 commit comments

Comments
 (0)