From 0af7267a176f3d53046b54c6de253599ee68f675 Mon Sep 17 00:00:00 2001 From: Dan Eble Date: Sat, 6 Sep 2014 14:35:20 -0400 Subject: [PATCH] Issue 4094: Check for Note_column interface before using grob. Rest_collision was calling Note_column functions on grobs that did not have the Note_column interface. Now Rest_collision ignores such grobs and Note_column will print a more accurate message if such an error ever happens again. --- lily/note-column.cc | 5 ++++- lily/rest-collision.cc | 11 +++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lily/note-column.cc b/lily/note-column.cc index 73b1387571..dcca364e17 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -107,7 +107,10 @@ Note_column::dir (Grob *me) return (Direction)sign (head_positions_interval (me).center ()); } - programming_error ("note column without heads and stem"); + if (has_interface (me)) + programming_error ("Note_column without heads and stem"); + else + programming_error ("dir() given grob without Note_column interface"); return CENTER; } diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index ac79df4fbd..d82358661f 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -108,10 +108,13 @@ Rest_collision::calc_positioning_done (SCM smob) for (vsize i = 0; i < elts.size (); i++) { Grob *e = elts[i]; - if (Grob::unsmob (e->get_object ("rest"))) - rests.push_back (e); - else - notes.push_back (e); + if (Note_column::has_interface (e)) + { + if (Grob::unsmob (e->get_object ("rest"))) + rests.push_back (e); + else + notes.push_back (e); + } } /* -- 2.39.2