forked from mirrors/Scribe.js
Fix: check err after anything else
This commit is contained in:
parent
92f6dc830f
commit
a4480bd7ae
1 changed files with 9 additions and 4 deletions
|
@ -64,11 +64,16 @@
|
|||
fs.readdir(dirPath, function (err, list) {
|
||||
var dir = [];
|
||||
|
||||
list.forEach(function (item) {
|
||||
dir.push(readNode(path.join(dirPath, item)));
|
||||
});
|
||||
if (err) {
|
||||
callback(err, null);
|
||||
} else {
|
||||
list.forEach(function (item) {
|
||||
dir.push(readNode(path.join(dirPath, item)));
|
||||
});
|
||||
|
||||
callback(null, dir);
|
||||
}
|
||||
|
||||
callback(null, dir);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue