Made Timer#initialize reject infinite floats for the interval.
authorTilman Sauerbeck <tilman@code-monkey.de>
Sun, 8 Apr 2007 12:00:20 +0000 (14:00 +0200)
committerTilman Sauerbeck <tilman@code-monkey.de>
Sun, 8 Apr 2007 12:00:20 +0000 (14:00 +0200)
src/ecore/rb_timer.c

index 4d05d48..6ef4d75 100644 (file)
@@ -84,6 +84,11 @@ static VALUE c_init (VALUE self, VALUE interval)
        if (!rb_block_given_p ())
                rb_raise (rb_eStandardError, "block missing");
 
+       interval = rb_funcall2 (interval, rb_intern ("to_f"), 0, NULL);
+
+       if (rb_funcall2 (interval, rb_intern ("finite?"), 0, NULL) == Qfalse)
+               rb_raise (rb_eArgError, "Argument must not be infinite");
+
        timer->callback = rb_block_proc ();
        timer->deleted = false;
        timer->real = ecore_timer_add (NUM2DBL (interval),