[ruby] must not do a null check for VALUE.

This commit is contained in:
Takashi Tamura 2017-03-07 11:43:01 +09:00
commit cb1f89cb68

View file

@ -67,9 +67,9 @@ namespace swig {
static std::shared_ptr<Type> as(VALUE obj, bool throw_error) { static std::shared_ptr<Type> as(VALUE obj, bool throw_error) {
std::shared_ptr<Type> ret; std::shared_ptr<Type> ret;
std::shared_ptr<Type> *v = &ret; std::shared_ptr<Type> *v = &ret;
int res = (obj ? traits_asptr<std::shared_ptr<Type> >::asptr(obj, &v) : SWIG_ERROR); int res = traits_asptr<std::shared_ptr<Type> >::asptr(obj, &v);
if (SWIG_IsOK(res)) { if (SWIG_IsOK(res)) {
return ret; return ret;
} else { } else {
// Uninitialized return value, no Type() constructor required. // Uninitialized return value, no Type() constructor required.
if (throw_error) throw std::invalid_argument("bad type"); if (throw_error) throw std::invalid_argument("bad type");
@ -82,7 +82,7 @@ namespace swig {
return *v_def; return *v_def;
} }
} }
}; };
} }
#endif #endif
%} %}