diff --git a/lib/matplotlib/collections.py b/lib/matplotlib/collections.py index 2e1d75c6d411..2fca1d84e65a 100644 --- a/lib/matplotlib/collections.py +++ b/lib/matplotlib/collections.py @@ -2200,6 +2200,9 @@ def get_cursor_data(self, event): if len(info["ind"]) == 1: ind, = info["ind"] array = self.get_array() - return array[ind] if array else None + if array is not None: + return array[ind] + else: + return None else: return None