Skip to content

Commit

Permalink
decoderからの読み取り時のNullチェックを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuki0824 committed Sep 1, 2024
1 parent 1c8f1d6 commit 468abd0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions b25-sys/src/bindings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 468abd0

Please sign in to comment.