no blank line if no LOC

This commit is contained in:
Ben Burdette 2020-05-12 14:41:30 -06:00
parent 960d4362ed
commit ecbb8e9c0a
3 changed files with 4 additions and 2 deletions

View file

@ -17,7 +17,8 @@ makefiles = \
misc/upstart/local.mk \
doc/manual/local.mk \
tests/local.mk \
tests/plugins/local.mk
tests/plugins/local.mk \
src/error-demo/local.mk
-include Makefile.config

View file

@ -1,5 +1,6 @@
#include "logging.hh"
#include "nixexpr.hh"
#include "util.hh"
#include <iostream>
#include <optional>

View file

@ -182,7 +182,7 @@ std::ostream& operator<<(std::ostream &out, const ErrorInfo &einfo)
}
// lines of code.
if (einfo.nixCode.has_value()) {
if (einfo.nixCode.has_value() && einfo.nixCode->errLineOfCode.has_value()) {
printCodeLines(out, prefix, *einfo.nixCode);
out << prefix << std::endl;
}