Update src/nix/search.cc

Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
This commit is contained in:
Eelco Dolstra 2020-05-07 12:13:16 +02:00 committed by GitHub
parent 1ad71bc62c
commit 14a3a62bfc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)!");
}
};