fix: nil error fix
This commit is contained in:
1 parent
a6c1f51b5d
commit
a99ecd2c3c
1 file changed
+13
-9
@@ -280,13 +280,17 @@ export default class Explorer extends Component<ExplorerProps> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getRootNode(workdir: string) {
|
getRootNode(workdir: string) {
|
||||||
return new FileDataNode({
|
if(workdir && workdir!==""){
|
||||||
name: path.basename(workdir),
|
return new FileDataNode({
|
||||||
filepath: workdir,
|
name: path.basename(workdir),
|
||||||
isFolder: true,
|
filepath: workdir,
|
||||||
parent: null,
|
isFolder: true,
|
||||||
children: []
|
parent: null,
|
||||||
});
|
children: []
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// renderContextMeun(selectedNode: FileDataNode) {
|
// renderContextMeun(selectedNode: FileDataNode) {
|
||||||
@@ -379,8 +383,8 @@ export default class Explorer extends Component<ExplorerProps> {
|
|||||||
const { onOpenTree, onDeleteTree, workdir } = this.props;
|
const { onOpenTree, onDeleteTree, workdir } = this.props;
|
||||||
|
|
||||||
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