Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added guard against no line matches in grep from phaseq's fork

  • Loading branch information...
commit 1a6b191f89ee0109c9a3b2775cd0b1170deade36 1 parent f20bc2e
Shifty authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 Node/shell/builtin/grep.js
View
5 Node/shell/builtin/grep.js
@@ -114,7 +114,10 @@ exports.main = function (tokens, pipes, exit) {
// Filter values recursively.
data = grep(data, pattern);
-
+ // Guard against no line matches -- Thanks 'phaseq'
+ if( data == null ) {
+ data = new Array();
+ }
if (json) {
// Serialize
data = JSON.stringify(data);
Please sign in to comment.
Something went wrong with that request. Please try again.