Skip to content

Commit

Permalink
prevent stackoverflow in color_discrete_manual, fixes #844
Browse files Browse the repository at this point in the history
  • Loading branch information
tlnagy committed Aug 27, 2016
1 parent f6183ac commit c40e791
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/scale.jl
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ const color_discrete = color_discrete_hue
@deprecate discrete_color(; levels=nothing, order=nothing, preserve_order=true) color_discrete(; levels=levels, order=order, preserve_order=preserve_order)


color_discrete_manual(colors...; levels=nothing, order=nothing) = color_discrete_manual(map(Gadfly.parse_colorant, colors)...; levels=levels, order=order)
color_discrete_manual(colors::AbstractString...; levels=nothing, order=nothing) = color_discrete_manual(map(Gadfly.parse_colorant, colors)...; levels=levels, order=order)

function color_discrete_manual(colors::Color...; levels=nothing, order=nothing)
cs = [colors...]
Expand Down
7 changes: 4 additions & 3 deletions test/discrete_color_manual.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

using Gadfly
using Colors
using Base.Test

# This should throw a MethodError, not a stackoverflow
@test_throws MethodError Scale.color_discrete_manual([RGBA(0,0,0,0.1)])

plot([sin, cos], 0, 25, Scale.color_discrete_manual("red", "purple"))


0 comments on commit c40e791

Please sign in to comment.