diff --git a/src/libutil/error.cc b/src/libutil/error.cc index 3a9b924f2..65c5813a4 100644 --- a/src/libutil/error.cc +++ b/src/libutil/error.cc @@ -94,8 +94,10 @@ std::optional getCodeLines(const ErrPos &errPos) } } catch (EndOfFile &eof) { - // TODO: return maybe partial loc? - return std::nullopt; + if (loc.errLineOfCode.has_value()) + return loc; + else + return std::nullopt; } catch (std::exception &e) { printError("error reading nix file: %s\n%s", errPos.file, e.what());