summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2016-10-17 08:41:25 -0400
committerFred Hebert <mononcqc@ferd.ca>2016-10-17 08:41:25 -0400
commit504431473b9cc7f9c1641f640fc4d8a02c9aa079 (patch)
treeb4ebeffad41331730aaa3a1ffaea7783d5888fc9 /src
parent94f87477d5db0243992ca222c79486acbfb9fcee (diff)
Prevent crashes in `rebar3 as` with no tasks
checks on hd(...) and so on could not handle empty lists
Diffstat (limited to 'src')
-rw-r--r--src/rebar_prv_as.erl6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/rebar_prv_as.erl b/src/rebar_prv_as.erl
index b4f7ac4..e7c6d68 100644
--- a/src/rebar_prv_as.erl
+++ b/src/rebar_prv_as.erl
@@ -33,9 +33,11 @@ init(State) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) ->
{Profiles, Tasks} = args_to_profiles_and_tasks(rebar_state:command_args(State)),
- case Profiles of
- [] ->
+ case {Profiles, Tasks} of
+ {[], _} ->
{error, "At least one profile must be specified when using `as`"};
+ {_, []} ->
+ {error, "At least one task must be specified when using `as`"};
_ ->
warn_on_empty_profile(Profiles, State),
State1 = rebar_state:apply_profiles(State, [list_to_atom(X) || X <- Profiles]),