mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Prevent crash when coreNodesDir is empty (#2831)
* Fix for HTTP-Request not sending body for GET Background in SO question: https://stackoverflow.com/q/60356824/504554 * Prevent crash when coreNodesDir points to empty dir This should prevent a crash when you point to an empty core nodes directory. * Matching upstream master
This commit is contained in:
parent
06ceb056f3
commit
ca44af0625
@ -28,6 +28,7 @@ function getFlowsFromPath(path) {
|
|||||||
fs.readdir(path,function(err,files) {
|
fs.readdir(path,function(err,files) {
|
||||||
var promises = [];
|
var promises = [];
|
||||||
var validFiles = [];
|
var validFiles = [];
|
||||||
|
if (files) {
|
||||||
files.forEach(function(file) {
|
files.forEach(function(file) {
|
||||||
var fullPath = fspath.join(path,file);
|
var fullPath = fspath.join(path,file);
|
||||||
var stats = fs.lstatSync(fullPath);
|
var stats = fs.lstatSync(fullPath);
|
||||||
@ -39,6 +40,7 @@ function getFlowsFromPath(path) {
|
|||||||
promises.push(Promise.resolve(file.split(".")[0]))
|
promises.push(Promise.resolve(file.split(".")[0]))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
var i=0;
|
var i=0;
|
||||||
Promise.all(promises).then(function(results) {
|
Promise.all(promises).then(function(results) {
|
||||||
results.forEach(function(r) {
|
results.forEach(function(r) {
|
||||||
|
Loading…
Reference in New Issue
Block a user