diff --git a/srcpkgs/ledger/patches/417.diff b/srcpkgs/ledger/patches/417.diff
new file mode 100644
index 0000000000..fe4e38fa24
--- /dev/null
+++ b/srcpkgs/ledger/patches/417.diff
@@ -0,0 +1,109 @@
+https://patch-diff.githubusercontent.com/raw/ledger/ledger/pull/417.diff
+
+diff --git src/account.h src/account.h
+index 7fae93e..8d0fb1d 100644
+--- src/account.h
++++ src/account.h
+@@ -261,11 +261,7 @@ class account_t : public supports_flags<>, public scope_t
+   mutable optional<xdata_t> xdata_;
+ 
+   bool has_xdata() const {
+-#if BOOST_VERSION >= 105600
+-    return xdata_ != NULL;
+-#else
+-    return xdata_;
+-#endif
++    return xdata_ != boost::none;
+   }
+   void clear_xdata();
+   xdata_t& xdata() {
+diff --git src/filters.cc src/filters.cc
+index 2f97a0e..b6530c0 100644
+--- src/filters.cc
++++ src/filters.cc
+@@ -707,7 +707,7 @@ namespace {
+     insert_prices_in_map(price_map_t& _all_prices)
+       : all_prices(_all_prices) {}
+ 
+-    void operator()(datetime_t& date, const amount_t& price) {
++    void operator()(const datetime_t& date, const amount_t& price) {
+       all_prices.insert(price_map_t::value_type(date, price));
+     }
+   };
+diff --git src/item.h src/item.h
+index ba81217..2c349bd 100644
+--- src/item.h
++++ src/item.h
+@@ -174,11 +174,7 @@ class item_t : public supports_flags<uint_least16_t>, public scope_t
+   static bool use_aux_date;
+ 
+   virtual bool has_date() const {
+-#if BOOST_VERSION >= 105600
+-    return _date != NULL;
+-#else
+-    return _date;
+-#endif
++    return _date != boost::none;
+   }
+ 
+   virtual date_t date() const {
+diff --git src/iterators.cc src/iterators.cc
+index 21bec5d..0225e21 100644
+--- src/iterators.cc
++++ src/iterators.cc
+@@ -96,7 +96,7 @@ namespace {
+       TRACE_DTOR(create_price_xact);
+     }
+ 
+-    void operator()(datetime_t& date, const amount_t& price) {
++    void operator()(const datetime_t& date, const amount_t& price) {
+       xact_t * xact;
+       string   symbol = price.commodity().symbol();
+ 
+diff --git src/parser.h src/parser.h
+index e46fc71..25c4a7e 100644
+--- src/parser.h
++++ src/parser.h
+@@ -118,7 +118,7 @@ class expr_t::parser_t : public noncopyable
+ 
+   ptr_op_t parse(std::istream&           in,
+                  const parse_flags_t&    flags           = PARSE_DEFAULT,
+-                 const optional<string>& original_string = NULL);
++                 const optional<string>& original_string = boost::none);
+ };
+ 
+ } // namespace ledger
+diff --git src/post.h src/post.h
+index 0fb45e9..3fa67e5 100644
+--- src/post.h
++++ src/post.h
+@@ -205,11 +205,7 @@ class post_t : public item_t
+   mutable optional<xdata_t> xdata_;
+ 
+   bool has_xdata() const {
+-#if BOOST_VERSION >= 105600
+-    return xdata_ != NULL;
+-#else
+-    return xdata_;
+-#endif
++    return xdata_ != boost::none;
+   }
+   void clear_xdata() {
+     xdata_ = none;
+diff --git src/times.h src/times.h
+index 421d146..cc98085 100644
+--- src/times.h
++++ src/times.h
+@@ -500,11 +500,7 @@ class date_interval_t : public equality_comparable<date_interval_t>
+   void   stabilize(const optional<date_t>& date = none);
+ 
+   bool   is_valid() const {
+-#if BOOST_VERSION >= 105600
+-    return start != NULL;
+-#else
+-    return start;
+-#endif
++    return start != boost::none;
+   }
+ 
+   /** Find the current or next period containing date.  Returns false if
diff --git a/srcpkgs/ledger/template b/srcpkgs/ledger/template
index bb6f85f337..9bfc45cd37 100644
--- a/srcpkgs/ledger/template
+++ b/srcpkgs/ledger/template
@@ -1,7 +1,7 @@
 # Template file for 'ledger'
 pkgname=ledger
 version=3.1
-revision=1
+revision=2
 build_style=cmake
 maintainer="Dominik Honnef <dominik@honnef.co>"
 hostmakedepends="cmake git"