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) {
|
fs.readdir(dirPath, function (err, list) {
|
||||||
var dir = [];
|
var dir = [];
|
||||||
|
|
||||||
list.forEach(function (item) {
|
if (err) {
|
||||||
dir.push(readNode(path.join(dirPath, item)));
|
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