From 00b5a83a755dc76c2086aaa903add737cdfc7095 Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Fri, 6 Oct 2023 20:25:55 -0500 Subject: [PATCH] Never allow null buffer through --- core/src/main/java/org/jruby/RubyIOBuffer.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/main/java/org/jruby/RubyIOBuffer.java b/core/src/main/java/org/jruby/RubyIOBuffer.java index a538933a178e..149b41662090 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); }