Skip to content

Commit 35382f4

Browse files
committed
throw err msg when creating unf objects with no support/classes
1 parent 4d8548e commit 35382f4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/types.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,12 @@ function UnivariateFinite(
298298

299299
# `LittleDict`s preserve order of keys, which we need for rand():
300300
_support = keys(prob_given_class) |> collect |> sort
301-
301+
isempty(_support) && throw(
302+
ArgumentError(
303+
"Cannot create `UnivariateFinite` and `UnivariateFininiteArray`"*
304+
" objects with no classes/support."
305+
)
306+
)
302307
# retrieve decoder and classes from first key:
303308
class1 = first(_support)
304309
parent_decoder = decoder(class1)

0 commit comments

Comments
 (0)