Skip to content

Commit 148fc42

Browse files
authored
Merge pull request jruby#8546 from enebo/unpack_comments
Fix specs involving comments in unpack format strings
2 parents 45e9520 + 6c6ca33 commit 148fc42

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

core/src/main/java/org/jruby/util/Pack.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -986,11 +986,10 @@ private static IRubyObject unpackInternal(ThreadContext context, RubyString enco
986986
if (isSpace(type)) continue;
987987

988988
if (type == '#') {
989-
while (type != '\n') {
990-
if (next == 0) break mainLoop;
991-
type = next;
992-
next = getDirective(context, "unpack", formatString, format);
993-
}
989+
for (type = safeGet(format); type != '\n' && type != 0; type = safeGet(format)) {}
990+
type = safeGet(format);
991+
if (type == 0) break;
992+
next = getDirective(context, "unpack", formatString, format);
994993
}
995994

996995
// Next indicates to decode using native encoding format

0 commit comments

Comments
 (0)