Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b39fd90

Browse files
committed
FIX: protect against None child
1 parent 4cc9a74 commit b39fd90

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/offsetbox.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ def axes(self, ax):
192192
# TODO deal with this better
193193
martist.Artist.axes.fset(self, ax)
194194
for c in self.get_children():
195-
c.axes = ax
195+
if c is not None:
196+
c.axes = ax
196197

197198
def contains(self, mouseevent):
198199
for c in self.get_children():
@@ -1053,7 +1054,8 @@ def __init__(self, loc,
10531054
def set_child(self, child):
10541055
"set the child to be anchored"
10551056
self._child = child
1056-
child.axes = self.axes
1057+
if child is not None:
1058+
child.axes = self.axes
10571059
self.stale = True
10581060

10591061
def get_child(self):

0 commit comments

Comments
 (0)