Skip to content

Commit

Permalink
bindings/python: fix ctypes null pointer check
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Thomas <mattypiper@gmail.com>
  • Loading branch information
mattypiper authored and pcercuei committed Aug 27, 2021
1 parent 92d6a35 commit 1e25313
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bindings/python/iio.py
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ def find_channel(self, name_or_id, is_output=False):
The IIO Device
"""
chn = _d_find_channel(self._device, name_or_id.encode("ascii"), is_output)
return None if chn is None else Channel(self, chn)
return None if bool(chn) is False else Channel(self, chn)

def set_kernel_buffers_count(self, count):
"""
Expand Down Expand Up @@ -1411,7 +1411,7 @@ def find_device(self, name_or_id_or_label):
The IIO Device
"""
dev = _find_device(self._context, name_or_id_or_label.encode("ascii"))
return None if dev is None else Trigger(self, dev) if _d_is_trigger(dev) else Device(self, dev)
return None if bool(dev) is False else Trigger(self, dev) if _d_is_trigger(dev) else Device(self, dev)

name = property(
lambda self: self._name, None, None, "Name of this IIO context.\n\ttype=str"
Expand Down

0 comments on commit 1e25313

Please sign in to comment.