summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/item.cc5
-rw-r--r--src/times.cc2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/item.cc b/src/item.cc
index 99d1d835..f86b8ec8 100644
--- a/src/item.cc
+++ b/src/item.cc
@@ -437,9 +437,12 @@ void print_item(std::ostream& out, const item_t& item, const string& prefix)
string item_context(const item_t& item, const string& desc)
{
+ if (! item.pos)
+ return empty_string;
+
std::streamoff len = item.pos->end_pos - item.pos->beg_pos;
if (! len)
- return _("<no item context>");
+ return empty_string;
assert(len > 0);
assert(len < 2048);
diff --git a/src/times.cc b/src/times.cc
index d4317509..7ea3ae32 100644
--- a/src/times.cc
+++ b/src/times.cc
@@ -224,7 +224,7 @@ namespace {
when = date_t(year ? *year : CURRENT_DATE().year(),
when.month(), when.day());
- if (when.month() > CURRENT_DATE().month())
+ if (! year && when.month() > CURRENT_DATE().month())
when -= gregorian::years(1);
}
}