aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}