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

Skip to content

Commit 89365c1

Browse files
committed
Properly handle NULL composite image
1 parent b391f08 commit 89365c1

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/matplotlib/image.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,12 @@ def flush_images():
149149
elif len(image_group) > 1:
150150
data, l, b = composite_images(
151151
image_group, renderer, mag)
152-
gc = renderer.new_gc()
153-
gc.set_clip_rectangle(parent.bbox)
154-
gc.set_clip_path(parent.get_clip_path())
155-
renderer.draw_image(gc, round(l), round(b), data)
156-
gc.restore()
152+
if data is not None:
153+
gc = renderer.new_gc()
154+
gc.set_clip_rectangle(parent.bbox)
155+
gc.set_clip_path(parent.get_clip_path())
156+
renderer.draw_image(gc, round(l), round(b), data)
157+
gc.restore()
157158
del image_group[:]
158159

159160
for zorder, a in dsu:

0 commit comments

Comments
 (0)