From 435b36a3e6576cebf794d815ae7cc78b652180f9 Mon Sep 17 00:00:00 2001
From: Mike Solomon <mike@apollinemike.com>
Date: Tue, 9 Aug 2011 08:44:45 +0200
Subject: [PATCH] Fixes issue 1796.

Issues a warning if the user tries to add footnotes without a footer.
---
 lily/page-breaking.cc       | 3 ++-
 lily/page-layout-problem.cc | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/lily/page-breaking.cc b/lily/page-breaking.cc
index 2e5854885e..f81683a257 100644
--- a/lily/page-breaking.cc
+++ b/lily/page-breaking.cc
@@ -577,7 +577,8 @@ Page_breaking::draw_page (SCM systems, SCM configuration, int page_num, int foot
 
   Page_layout_problem::add_footnotes_to_footer (footnotes, foot, book_);
 
-  p->set_property ("foot-stencil", foot->smobbed_copy ());
+  if (foot)
+    p->set_property ("foot-stencil", foot->smobbed_copy ());
   scm_apply_1 (page_stencil, page, SCM_EOL);
 
   return page;
diff --git a/lily/page-layout-problem.cc b/lily/page-layout-problem.cc
index c9301ff384..2988a091b6 100644
--- a/lily/page-layout-problem.cc
+++ b/lily/page-layout-problem.cc
@@ -277,6 +277,11 @@ Page_layout_problem::get_footnote_separator_stencil (Output_def *paper)
 void
 Page_layout_problem::add_footnotes_to_footer (SCM footnotes, Stencil *foot, Paper_book *pb)
 {
+  if (!foot && scm_is_pair (footnotes))
+    {
+      warning ("Must have a footer to add footnotes.");
+      return;
+    }
   bool footnotes_found = false;
   Real footnote_padding = robust_scm2double (pb->paper_->c_variable ("footnote-padding"), 0.0);
   Real footnote_footer_padding = robust_scm2double (pb->paper_->c_variable ("footnote-footer-padding"), 0.0);
-- 
2.39.5