Fix null path exception when checking path

tsc compiles default parameter to have `path === void 0`, which doesn't
catch the case of path is null.
This commit is contained in:
Sida Chen 2018-10-22 23:50:40 -04:00
parent bb01e08d44
commit d0d44605a9

View file

@ -42,7 +42,7 @@ export class DockerfilePathSelectComponent implements OnChanges {
this.isUnknownPath = false; this.isUnknownPath = false;
var isValidPath: boolean = false; var isValidPath: boolean = false;
if (path.length > 0 && path[0] === '/') { if (path != null && path.length > 0 && path[0] === '/') {
isValidPath = true; isValidPath = true;
this.isUnknownPath = supportsFullListing && paths.indexOf(path) < 0; this.isUnknownPath = supportsFullListing && paths.indexOf(path) < 0;
} }