summaryrefslogtreecommitdiff
path: root/struct.c
diff options
context:
space:
mode:
Diffstat (limited to 'struct.c')
-rw-r--r--struct.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/struct.c b/struct.c
index 961475d28f..4d9018a611 100644
--- a/struct.c
+++ b/struct.c
@@ -496,12 +496,14 @@ rb_struct_aset(s, idx, val)
i = NUM2LONG(idx);
if (i < 0) i = RSTRUCT(s)->len + i;
- if (i < 0)
+ if (i < 0) {
rb_raise(rb_eIndexError, "offset %d too small for struct(size:%d)",
i, RSTRUCT(s)->len);
- if (RSTRUCT(s)->len <= i)
+ }
+ if (RSTRUCT(s)->len <= i) {
rb_raise(rb_eIndexError, "offset %d too large for struct(size:%d)",
i, RSTRUCT(s)->len);
+ }
if (OBJ_FROZEN(s)) rb_error_frozen("Struct");
return RSTRUCT(s)->ptr[i] = val;
}