Skip to content

Commit

Permalink
Merge pull request #886 from tlnagy/fix-color-manual-stackoverflow
Browse files Browse the repository at this point in the history
prevent stackoverflow in color_discrete_manual, fixes #844
  • Loading branch information
shashi committed Aug 28, 2016
2 parents 1196f07 + c40e791 commit 30670b3
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 30670b3

Please sign in to comment.