提交 b239d2a3 编写于 作者: D Daniel Imms

Strict null check files/test/electron-browser/utils.ts

Part of #60565
上级 7d80b00c
......@@ -508,6 +508,7 @@
"./vs/workbench/services/files/node/watcher/common.ts",
"./vs/workbench/services/files/node/watcher/nsfw/watcher.ts",
"./vs/workbench/services/files/node/watcher/unix/watcher.ts",
"./vs/workbench/services/files/test/electron-browser/utils.ts",
"./vs/workbench/services/hash/common/hashService.ts",
"./vs/workbench/services/hash/node/hashService.ts",
"./vs/workbench/services/issue/common/issue.ts",
......
......@@ -5,7 +5,11 @@
import { IFileStat } from 'vs/platform/files/common/files';
export function getByName(root: IFileStat, name: string): IFileStat {
export function getByName(root: IFileStat, name: string): IFileStat | null {
if (root.children === undefined) {
return null;
}
for (let i = 0; i < root.children.length; i++) {
if (root.children[i].name === name) {
return root.children[i];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册