Skip to content

Commit

Permalink
decoderからの読み取り時のNullチェックを追加 (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuki0824 authored Sep 1, 2024
1 parent 7fb5009 commit dea64f7
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 dea64f7

Please sign in to comment.