don't crash on missing wsl distro flags - fixes #2744

This commit is contained in:
Eugene Pankov 2020-06-30 15:34:55 +02:00
parent 6e9ac1b59a
commit 11c8ca6582
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4

View File

@ -88,7 +88,7 @@ export class WSLShellProvider extends ShellProvider {
if (!childKey.DistributionName) {
continue
}
const wslVersion = childKey.Flags.value & 8 ? 2 : 1
const wslVersion = (childKey.Flags?.value || 0) & 8 ? 2 : 1
const name = childKey.DistributionName.value
const fsBase = wslVersion === 2 ? `\\\\wsl$\\${name}` : childKey.BasePath.value as string + '\\rootfs'
const slug = slugify(name, { remove: /[:.]/g })