diff --git a/lib/matplotlib/collections.py b/lib/matplotlib/collections.py index a072e22a73fb..28cbcca973d6 100644 --- a/lib/matplotlib/collections.py +++ b/lib/matplotlib/collections.py @@ -2214,6 +2214,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