Skip to content

Commit d89187e

Browse files
committed
fix error on empty edge arguments
fixes #237
1 parent 84be521 commit d89187e

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/recipes.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ end
783783

784784
function _expand_args(args::Union{AbstractVector, AbstractDict}, ranges)
785785
N_paths = length(ranges)
786-
N_points = ranges[end][end]
786+
N_points = N_paths > 0 ? ranges[end][end] : 0
787787
allstraight = N_paths*3 == N_points
788788
if args isa AbstractVector && length(args) != N_paths
789789
throw(ArgumentError("The length of the args vector $args does not match the number of edges!"))

test/runtests.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,12 @@ end
278278
@test ax isa LScene
279279
end
280280

281-
@testset "test empty endge Blot" begin
281+
@testset "test empty edge plot" begin
282282
GraphMakie.edgeplot(GraphMakie.Line{Point{2, Float32}}[])
283283
GraphMakie.edgeplot(GraphMakie.AbstractPath{Point{2, Float32}}[])
284+
285+
# test empty edge color
286+
graphplot(SimpleGraph(2); edge_color=Symbol[])
284287
end
285288

286289
include("referencetests.jl")

0 commit comments

Comments
 (0)