fix access undefined when no files in folder

This commit is contained in:
2022-06-12 00:24:28 +08:00
parent 212ab56722
commit a9c2c2d7f9

View File

@@ -27,7 +27,9 @@ function FilesInFolder(props) {
alert(data.error);
} else {
setFiles(data.files);
setNewFoldername(data.files[0].foldername);
if (data.files.length > 0) {
setNewFoldername(data.files[0].foldername);
}
}
})
.catch((error) => alert(error))