diff options
author | alisdair sullivan <alisdairsullivan@yahoo.ca> | 2016-10-17 13:41:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-17 13:41:05 -0700 |
commit | 4e7b765645d7eb49da750ed59bb917d41cd08a66 (patch) | |
tree | b4ebeffad41331730aaa3a1ffaea7783d5888fc9 /src | |
parent | 94f87477d5db0243992ca222c79486acbfb9fcee (diff) | |
parent | 504431473b9cc7f9c1641f640fc4d8a02c9aa079 (diff) |
Merge pull request #1356 from ferd/prevent-as-crash-on-missing-tasks
Prevent crashes in `rebar3 as` with no tasks
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_prv_as.erl | 6 |
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]), |