From dea64f773e2dc079b112334882fcf4840f5f6eea Mon Sep 17 00:00:00 2001 From: maleicacid <4982384+kazuki0824@users.noreply.github.com> Date: Sun, 1 Sep 2024 22:13:17 +0900 Subject: [PATCH] =?UTF-8?q?decoder=E3=81=8B=E3=82=89=E3=81=AE=E8=AA=AD?= =?UTF-8?q?=E3=81=BF=E5=8F=96=E3=82=8A=E6=99=82=E3=81=AENull=E3=83=81?= =?UTF-8?q?=E3=82=A7=E3=83=83=E3=82=AF=E3=82=92=E8=BF=BD=E5=8A=A0=20(#121)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- b25-sys/src/bindings/mod.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/b25-sys/src/bindings/mod.rs b/b25-sys/src/bindings/mod.rs index bd352dd..ca999b4 100644 --- a/b25-sys/src/bindings/mod.rs +++ b/b25-sys/src/bindings/mod.rs @@ -140,12 +140,16 @@ impl Read for InnerDecoder { }; let code = self.dec.as_ref().get(&mut buffer_struct); - std::ptr::copy_nonoverlapping( - buffer_struct.data as *const u8, - buf.as_mut_ptr(), - buffer_struct.size as usize, - ); - (code, buffer_struct.size as usize) + if buffer_struct.data.is_null() { + (0, 0) + } else { + std::ptr::copy_nonoverlapping( + buffer_struct.data as *const u8, + buf.as_mut_ptr(), + buffer_struct.size as usize, + ); + (code, buffer_struct.size as usize) + } }; match code {