Archived
1
0
Fork 0

Implement argument type check for Tox#initialize

This commit is contained in:
Braiden Vasco 2015-09-11 21:29:46 +00:00
parent d97ef9a620
commit beb90a36be

View file

@ -54,7 +54,9 @@ VALUE cTox_initialize(const VALUE self, const VALUE options)
cTox_ *tox; cTox_ *tox;
cTox_cOptions_ *tox_options; 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(self, cTox_, tox);
Data_Get_Struct(options, cTox_cOptions_, tox_options); Data_Get_Struct(options, cTox_cOptions_, tox_options);