summaryrefslogtreecommitdiff
path: root/struct.c
diff options
context:
space:
mode:
Diffstat (limited to 'struct.c')
-rw-r--r--struct.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/struct.c b/struct.c
index 88357dedc9..aaa2a4bce7 100644
--- a/struct.c
+++ b/struct.c
@@ -41,7 +41,10 @@ rb_struct_s_members(klass)
VALUE members = rb_struct_iv_get(klass, "__members__");
if (NIL_P(members)) {
- rb_bug("non-initialized struct");
+ rb_raise(rb_eTypeError, "uninitialized struct");
+ }
+ if (TYPE(members) != T_ARRAY) {
+ rb_raise(rb_eTypeError, "corrupted struct");
}
return members;
}