mruby-pack (pack_unpack): unpack1 did not return single data; fix #6134

For following unpack directives:

- PACK_DIR_HEX (h)
- PACK_DIR_BSTR (b)
- PACK_DIR_STR (a,A,Z)
- PACK_DIR_BASE64 (m)
- PACK_DIR_QENC (M)
This commit is contained in:
Yukihiro "Matz" Matsumoto
2023-12-29 13:09:14 +09:00
parent 95aa92d5c4
commit 6d8323f3c7
+5 -5
View File
@@ -1727,12 +1727,12 @@ pack_unpack(mrb_state *mrb, mrb_value str, int single)
count--;
}
}
if (single) {
if (RARRAY_LEN(result) > 0) {
return RARRAY_PTR(result)[0];
}
return mrb_nil_value();
}
if (single) {
if (RARRAY_LEN(result) > 0) {
return RARRAY_PTR(result)[0];
}
return mrb_nil_value();
}
return result;
}