From e33c7bec39d677d0f211a98362cebd81124bb45b Mon Sep 17 00:00:00 2001 From: liyimin Date: Tue, 6 Jun 2023 16:02:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=A9=BA=E5=88=A4=E6=96=AD?= =?UTF-8?q?=EF=BC=8C=E9=81=BF=E5=85=8Dbuffer=E4=B8=BAnull=E6=97=B6?= =?UTF-8?q?=E6=8A=9B=E5=87=BA=20NullPointerException?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/java/net/jpountz/lz4/LZ4FrameInputStream.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/java/net/jpountz/lz4/LZ4FrameInputStream.java b/src/java/net/jpountz/lz4/LZ4FrameInputStream.java index 4a75bac..918f556 100644 --- a/src/java/net/jpountz/lz4/LZ4FrameInputStream.java +++ b/src/java/net/jpountz/lz4/LZ4FrameInputStream.java @@ -380,6 +380,8 @@ public long skip(long n) throws IOException { @Override public int available() throws IOException { + //增加空判断,避免buffer为null时抛出 NullPointerException + if (null == buffer) return 0; return buffer.remaining(); }