]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/dimension-cache.cc
release: 1.3.39
[lilypond.git] / lily / dimension-cache.cc
index f314dbc24eb9d8e27bf413b5bdce77314c90586f..eb6f7c24a94472e5b38b932ddc9ce06e7d7dbf2f 100644 (file)
@@ -5,6 +5,8 @@
   
   (c) 1998--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
  */
+#include <math.h>
+#include "warn.hh"
 
 #include "dimension-cache.hh"
 #include "parray.hh"
@@ -82,7 +84,13 @@ Dimension_cache::get_offset () const
     {
       Offset_cache_callback c = me->off_callbacks_[0];
       me->off_callbacks_.del (0);
-      me->basic_offset_ += (*c) (me);
+      Real r =  (*c) (me);
+      if (isinf (r) || isnan (r))
+       {
+         r = 0.0;
+         programming_error ("Infinity or NaN encountered");
+       }
+      me->basic_offset_ +=r;
     }
   return basic_offset_ + extra_offset_;
 }