]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/flag.cc
Fix and document usage of `convert-ly - < test.ly'.
[lilypond.git] / lily / flag.cc
index 77491befd6df84fb3d922718f7c7d82bfa73a5ce..31ddf349c92cf1098836fa98b11252ea19cf2b00 100644 (file)
@@ -186,11 +186,13 @@ Flag::internal_calc_y_offset (SCM smob, bool pure)
   Real blot
     = me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"));
 
-  Real y2 = pure
-            ? stem->pure_height (stem, 0, INT_MAX)[d]
-            : stem->extent (stem, Y_AXIS)[d];
+  Interval stem_extent = pure
+                         ? stem->pure_height (stem, 0, INT_MAX)
+                         : stem->extent (stem, Y_AXIS);
 
-  return scm_from_double (y2 - d * blot / 2);
+  return scm_from_double (stem_extent.is_empty ()
+                          ? 0.0
+                          : stem_extent[d] - d * blot / 2);
 }
 
 MAKE_SCHEME_CALLBACK (Flag, calc_x_offset, 1);