]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix 1382
authorCarl Sorensen <c_sorensen@byu.edu>
Sun, 14 Nov 2010 00:41:43 +0000 (17:41 -0700)
committerCarl Sorensen <c_sorensen@byu.edu>
Mon, 15 Nov 2010 17:09:07 +0000 (10:09 -0700)
input/regression/zero_staff_space.ly [new file with mode: 0644]
lily/staff-symbol-referencer.cc

diff --git a/input/regression/zero_staff_space.ly b/input/regression/zero_staff_space.ly
new file mode 100644 (file)
index 0000000..cc30e65
--- /dev/null
@@ -0,0 +1,17 @@
+
+\version "2.13.40"
+\header{
+
+  texidoc="
+Setting staff-space to 0 does not cause a segmentation fault.
+"
+
+}
+
+\new Staff \with {
+  \override StaffSymbol #'staff-space = #0
+  } {
+  \relative c' {
+    c1
+  }
+}
index bec8c8001f9d01ad741365808337c248a953ee94..4dbd6d2d6b0b354f9c8d91124786758c9b6af70c 100644 (file)
@@ -81,9 +81,9 @@ Staff_symbol_referencer::get_position (Grob *me)
   if (st && c)
     {
       Real y = me->relative_coordinate (c, Y_AXIS)
-       - st->relative_coordinate (c, Y_AXIS);
-
-      p += 2.0 * y / Staff_symbol::staff_space (st);
+              - st->relative_coordinate (c, Y_AXIS);
+      Real space = Staff_symbol::staff_space (st);
+      p = (space == 0) ? 0 : 2.0 * y / space;
       return p;
     }
   else if (!st)
@@ -153,7 +153,6 @@ Staff_symbol_referencer::set_position (Grob *me, Real p)
       oldpos = get_position (me);
     }
 
-  
   Real ss = Staff_symbol_referencer::staff_space (me);
   me->translate_axis ((p  - oldpos) * ss * 0.5, Y_AXIS);
 }