Skip to content

Commit 110d908

Browse files
committedJan 30, 2025
add error for df = nothing
1 parent 8fe2cb9 commit 110d908

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed
 

‎src/ParallelPlots.jl

+3-4
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ checks the Input Data if the size is correct and no missing values are available
1818
Throws error on wrong DF
1919
"""
2020
function input_data_check(data::DataFrame)
21-
if isnothing(data)
22-
throw(ArgumentError("Data cannot be nothing"))
23-
end
2421
if size(data, 2) < 2 # otherwise there will be a nullpointer exception later
2522
throw(ArgumentError("Data must have at least two columns, currently ("*string(size(data, 2))*")"))
2623
end
@@ -119,7 +116,9 @@ function Makie.plot!(pp::ParallelPlot)
119116
# this helper function will update our observables
120117
# whenever df_observable change
121118
function update_plot(data)
122-
119+
if isnothing(data)
120+
throw(ArgumentError("Data cannot be nothing"))
121+
end
123122
# check the given DataFrame
124123
input_data_check(data)
125124

‎test/test_argument_errors.jl

+3
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,7 @@ using CairoMakie: save
2525
@test_throws ArgumentError begin
2626
parallelplot(df_one_line)
2727
end
28+
@test_throws ArgumentError begin
29+
parallelplot(nothing)
30+
end
2831
end

0 commit comments

Comments
 (0)
Please sign in to comment.