]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/simple-spacer.cc
Imported Upstream version 2.18.0
[lilypond.git] / lily / simple-spacer.cc
index 88ebae09d85c4714e318013bbf5d6a5c8541a452..aef524da87579bb2ecb1e087409f0f2da04baa3f 100644 (file)
@@ -370,9 +370,12 @@ get_column_description (vector<Grob *> const &cols, vsize col_index, bool line_s
   if (next_col)
     description.spring_ = Spaceable_grob::get_spring (col, next_col);
 
-  Grob *end_col = dynamic_cast<Item *> (cols[col_index + 1])->find_prebroken_piece (LEFT);
-  if (end_col)
-    description.end_spring_ = Spaceable_grob::get_spring (col, end_col);
+  if (col_index + 1 < cols.size ())
+    {
+      Grob *end_col = dynamic_cast<Item *> (cols[col_index + 1])->find_prebroken_piece (LEFT);
+      if (end_col)
+        description.end_spring_ = Spaceable_grob::get_spring (col, end_col);
+    }
 
   for (SCM s = Spaceable_grob::get_minimum_distances (col);
        scm_is_pair (s); s = scm_cdr (s))
@@ -384,6 +387,9 @@ get_column_description (vector<Grob *> const &cols, vsize col_index, bool line_s
           if (cols[j] == other)
             description.rods_.push_back (Rod_description (j, scm_to_double (scm_cdar (s))));
           else /* it must end at the LEFT prebroken_piece */
+               /* see Spanner::set_spacing_rods for more comments on how
+                  to deal with situations where  we don't know if we're
+                  ending yet on the left prebroken piece */
             description.end_rods_.push_back (Rod_description (j, scm_to_double (scm_cdar (s))));
         }
     }