From ecbb8e9c0a4374b26defde2cd10932d633affed3 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Tue, 12 May 2020 14:41:30 -0600 Subject: [PATCH] no blank line if no LOC --- Makefile | 3 ++- src/error-demo/error-demo.cc | 1 + src/libutil/error.cc | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0ba011e2a..05c4bdc8a 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/src/error-demo/error-demo.cc b/src/error-demo/error-demo.cc index 82e9f0580..0216092e3 100644 --- a/src/error-demo/error-demo.cc +++ b/src/error-demo/error-demo.cc @@ -1,5 +1,6 @@ #include "logging.hh" #include "nixexpr.hh" +#include "util.hh" #include #include diff --git a/src/libutil/error.cc b/src/libutil/error.cc index e4f45a2d3..0765a2945 100644 --- a/src/libutil/error.cc +++ b/src/libutil/error.cc @@ -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; }