diff --git a/ext/tox/tox.c b/ext/tox/tox.c index 9f277d7..d93cc0e 100644 --- a/ext/tox/tox.c +++ b/ext/tox/tox.c @@ -54,7 +54,9 @@ VALUE cTox_initialize(const VALUE self, const VALUE options) cTox_ *tox; cTox_cOptions_ *tox_options; - /* check if `options` is instance of `Tox::Options` */ + // check if `options` is instance of `Tox::Options` + if (Qfalse == rb_funcall(options, rb_intern("is_a?"), 1, cTox_cOptions)) + rb_raise(rb_eTypeError, "argument 1 should be Tox::Options"); Data_Get_Struct(self, cTox_, tox); Data_Get_Struct(options, cTox_cOptions_, tox_options);