aboutsummaryrefslogtreecommitdiffstats
path: root/complex.c
diff options
context:
space:
mode:
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/complex.c b/complex.c
index 112135c7dd..e5d4a1192a 100644
--- a/complex.c
+++ b/complex.c
@@ -1943,8 +1943,10 @@ to_complex(VALUE val)
static VALUE
nucomp_convert(VALUE klass, VALUE a1, VALUE a2, int raise)
{
- if (NIL_P(a1) || NIL_P(a2))
+ if (NIL_P(a1) || NIL_P(a2)) {
+ if (!raise) return Qnil;
rb_raise(rb_eTypeError, "can't convert nil into Complex");
+ }
if (RB_TYPE_P(a1, T_STRING)) {
a1 = string_to_c_strict(a1, raise);