bug-lilypond
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issue 1382 in lilypond: Segfault when setting 'staff-space to 0.0


From: lilypond
Subject: Re: Issue 1382 in lilypond: Segfault when setting 'staff-space to 0.0
Date: Thu, 04 Nov 2010 20:58:48 +0000


Comment #1 on issue 1382 by pnorcks: Segfault when setting 'staff-space to 0.0
http://code.google.com/p/lilypond/issues/detail?id=1382

This is a divide-by-zero problem. The patch below stops the segfault, but I'm unsure if this is the solution we want.

diff --git a/lily/staff-symbol-referencer.cc b/lily/staff-symbol-referencer.cc
index bec8c80..5a70b16 100644
--- a/lily/staff-symbol-referencer.cc
+++ b/lily/staff-symbol-referencer.cc
@@ -83,7 +83,11 @@ Staff_symbol_referencer::get_position (Grob *me)
       Real y = me->relative_coordinate (c, Y_AXIS)
        - st->relative_coordinate (c, Y_AXIS);

-      p += 2.0 * y / Staff_symbol::staff_space (st);
+      Real staff_space = Staff_symbol::staff_space (st);
+      if (!staff_space)
+       staff_space = 1;
+      p += 2.0 * y / staff_space;
+
       return p;
     }
   else if (!st)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]