fix: nil error fix
This commit is contained in:
1 parent
a6c1f51b5d
commit
a99ecd2c3c
1 file changed
+5
-1
@@ -280,6 +280,7 @@ export default class Explorer extends Component<ExplorerProps> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getRootNode(workdir: string) {
|
getRootNode(workdir: string) {
|
||||||
|
if(workdir && workdir!==""){
|
||||||
return new FileDataNode({
|
return new FileDataNode({
|
||||||
name: path.basename(workdir),
|
name: path.basename(workdir),
|
||||||
filepath: workdir,
|
filepath: workdir,
|
||||||
@@ -287,6 +288,9 @@ export default class Explorer extends Component<ExplorerProps> {
|
|||||||
parent: null,
|
parent: null,
|
||||||
children: []
|
children: []
|
||||||
});
|
});
|
||||||
|
}else{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// renderContextMeun(selectedNode: FileDataNode) {
|
// renderContextMeun(selectedNode: FileDataNode) {
|
||||||
@@ -380,7 +384,7 @@ export default class Explorer extends Component<ExplorerProps> {
|
|||||||
|
|
||||||
const root = this.state.root;
|
const root = this.state.root;
|
||||||
if (!workdir || workdir === "" ) {
|
if (!workdir || workdir === "" ) {
|
||||||
return `请打开workspace.json文件`;
|
return (<div>请打开workspace.json文件</div>);
|
||||||
}
|
}
|
||||||
|
|
||||||
const nodes = root ? [root.getRenderData()] : [];
|
const nodes = root ? [root.getRenderData()] : [];
|
||||||
|
|||||||
Reference in new issue
Block a user