[wasm-rust] panic if buffer_set_contents fails

This commit is contained in:
Simon Cozens 2023-03-02 19:47:33 +00:00 committed by Behdad Esfahbod
parent 74a2f338c6
commit e78d8653ce
1 changed files with 3 additions and 1 deletions

View File

@ -304,7 +304,9 @@ impl<T: BufferItem> Drop for Buffer<T> {
position: positions[..].as_mut_ptr(), position: positions[..].as_mut_ptr(),
}; };
unsafe { unsafe {
buffer_set_contents(self._ptr, &c_contents); if !buffer_set_contents(self._ptr, &c_contents) {
panic!("Couldn't set buffer contents");
}
} }
} }
} }