diff --git a/core/src/main/java/org/jruby/RubyIOBuffer.java b/core/src/main/java/org/jruby/RubyIOBuffer.java index a538933a178..149b4166209 100644 --- a/core/src/main/java/org/jruby/RubyIOBuffer.java +++ b/core/src/main/java/org/jruby/RubyIOBuffer.java @@ -69,6 +69,8 @@ public static RubyClass createIOBufferClass(Ruby runtime) { public static final int NETWORK_ENDIAN = BIG_ENDIAN; public static RubyIOBuffer newBuffer(Ruby runtime, ByteBuffer base, int size, int flags) { + if (base == null) return newBuffer(runtime, size, flags); + return new RubyIOBuffer(runtime, runtime.getIOBuffer(), base, size, flags); }