Skip to content

Commit d38176f

Browse files
committed
draw/image: in scalar output before accessing colormap, check if it points to something
1 parent 9aa348d commit d38176f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

draw/image.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ func On(img *image.RGBA, f *data.Slice, fmin, fmax string, arrowSize int, colorm
4040

4141
case 1:
4242
min, max := parseMinMax(f, fmin, fmax)
43-
drawFloats(img, f.Scalars(), min, max, colormap[0].Cmap...)
43+
if colormap == nil {
44+
drawFloats(img, f.Scalars(), min, max)
45+
} else {
46+
drawFloats(img, f.Scalars(), min, max, colormap[0].Cmap...)
47+
}
4448
}
4549
}
4650

0 commit comments

Comments
 (0)