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

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"))
}