summaryrefslogtreecommitdiff
path: root/pack.c
diff options
context:
space:
mode:
Diffstat (limited to 'pack.c')
-rw-r--r--pack.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pack.c b/pack.c
index f011a1f2c4..e90c0141c9 100644
--- a/pack.c
+++ b/pack.c
@@ -868,10 +868,10 @@ pack_pack(ary, fmt)
from = NEXTFROM;
from = rb_to_int(from);
l = num2i32(from);
- le = uv_to_utf8(buf, l);
- if (TYPE(from) == T_BIGNUM) {
+ if (l < 0) {
rb_raise(rb_eRangeError, "pack(U): value out of range");
}
+ le = uv_to_utf8(buf, l);
rb_str_buf_cat(res, (char*)buf, le);
}
break;