aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Burdette <bburdette@gmail.com>2020-05-12 14:41:30 -0600
committerBen Burdette <bburdette@gmail.com>2020-05-12 14:41:30 -0600
commitecbb8e9c0a4374b26defde2cd10932d633affed3 (patch)
tree8d19dc4e1c19a78e184e358880948eb8be0dbc88
parent960d4362ed2215f87a596e0a994e39aa28680db1 (diff)
no blank line if no LOC
-rw-r--r--Makefile3
-rw-r--r--src/error-demo/error-demo.cc1
-rw-r--r--src/libutil/error.cc2
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 <iostream>
#include <optional>
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;
}