]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/spring.cc
more robustness to inf and nan in simple-spacer and spring
[lilypond.git] / lily / spring.cc
index 679ccfa29db3f00d2f792785a950e40be85f0b6a..c9f3afbe42a3ef4c71041b2cde980245fc283070 100644 (file)
@@ -152,5 +152,12 @@ Spring::length (Real f) const
 {
   Real force = max (f, blocking_force_);
   Real inv_k = force < 0.0 ? inverse_compress_strength_ : inverse_stretch_strength_;
+
+  if (isinf (force))
+    {
+      programming_error ("cruelty to springs");
+      force = 0.0;
+    }
+
   return distance_ + force * inv_k;
 }