Skip to content

Commit db04cd6

Browse files
committed
Add null check to pass strict: true
1 parent 0c6d8ad commit db04cd6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

APM-Final/src/app/products/product-detail.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ export class ProductDetailComponent implements OnInit {
1919
}
2020

2121
ngOnInit() {
22-
const id = +this._route.snapshot.paramMap.get('id');
23-
this.getProduct(id);
22+
const param = this._route.snapshot.paramMap.get('id');
23+
if (param) {
24+
const id = +param;
25+
this.getProduct(id);
26+
}
2427
}
2528

2629
getProduct(id: number) {

0 commit comments

Comments
 (0)