aboutsummaryrefslogtreecommitdiff
path: root/src/nix/search.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix/search.cc')
-rw-r--r--src/nix/search.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nix/search.cc b/src/nix/search.cc
index fca49350a..bbac56fcb 100644
--- a/src/nix/search.cc
+++ b/src/nix/search.cc
@@ -180,7 +180,7 @@ struct CmdSearch : InstallableCommand, MixJSON
for (auto & [cursor, prefix] : installable->getCursor(*state, true))
visit(*cursor, parseAttrPath(*state, prefix));
- if (!results)
+ if (!json && !results)
throw Error("no results for the given search term(s)!");
}
};