Use is_null() to check whether a ptr is null

This commit is contained in:
messense 2017-07-18 22:32:31 +08:00
parent ae40a30243
commit 39a78aa407
No known key found for this signature in database
GPG Key ID: BB41A8A2C716CCA9
1 changed files with 1 additions and 1 deletions

View File

@ -19,7 +19,7 @@ struct TestClass {
impl class::PyBufferProtocol for TestClass {
fn bf_getbuffer(&self, view: *mut ffi::Py_buffer, flags: c_int) -> PyResult<()> {
if view == ptr::null_mut() {
if view.is_null() {
return Err(PyErr::new::<exc::BufferError, _>(self.py(), "View is null"))
}