Browse files

Make sure empty_file is returned instead of null for list and data types

  • Loading branch information...
1 parent 80e0288 commit 5f5dda5f9fdbb8a8b9e7ddfc516444b3c5abe855 @smfreegard smfreegard committed Jul 21, 2012
Showing with 9 additions and 6 deletions.
  1. +9 −6 configfile.js
View
15 configfile.js
@@ -196,13 +196,16 @@ cfreader.load_flat_config = function(name, type) {
}
}
- if (result && result.length) {
- return result;
+ // Return hostname for 'me' if no result
+ if (/\/me$/.test(name) && !(result && result.length)) {
+ return [ require('os').hostname() ];
}
- else {
- if (/\/me$/.test(name)) {
- return [ require('os').hostname() ];
+
+ // For value types with no result
+ if (!(type && (type === 'list' || type === 'data'))) {
+ if (!(result && result.length)) {
+ return null;
}
- return null;
}
+ return result;
};

0 comments on commit 5f5dda5

Please sign in to comment.