Fix rebar_core crash (reported-by: Jeremy Raymond)

This commit is contained in:
Tuncer Ayaz 2011-12-18 13:29:58 +01:00
parent 58101588a1
commit 7c327c1195

View file

@ -115,23 +115,30 @@ process_dir(Dir, ParentConfig, Command, DirSet) ->
%% to process this dir. %% to process this dir.
{ok, AvailModuleSets} = application:get_env(rebar, modules), {ok, AvailModuleSets} = application:get_env(rebar, modules),
ModuleSet = choose_module_set(AvailModuleSets, Dir), ModuleSet = choose_module_set(AvailModuleSets, Dir),
{_DirModules, ModuleSetFile} = ModuleSet, maybe_process_dir(ModuleSet, Config, CurrentCodePath,
Dir, Command, DirSet)
end.
case lists:reverse(ModuleSetFile) of maybe_process_dir({[], undefined}=ModuleSet, Config, CurrentCodePath,
"ppa." ++ _ -> Dir, Command, DirSet) ->
%% .app file process_dir0(Dir, Command, DirSet, Config, CurrentCodePath, ModuleSet);
maybe_process_dir0(ModuleSetFile, ModuleSet, Config, maybe_process_dir({_, ModuleSetFile}=ModuleSet, Config, CurrentCodePath,
CurrentCodePath, Dir, Dir, Command, DirSet) ->
Command, DirSet); case lists:reverse(ModuleSetFile) of
"crs.ppa." ++ _ -> "ppa." ++ _ ->
%% .app.src file %% .app file
maybe_process_dir0(ModuleSetFile, ModuleSet, Config, maybe_process_dir0(ModuleSetFile, ModuleSet,
CurrentCodePath, Dir, Config, CurrentCodePath, Dir,
Command, DirSet); Command, DirSet);
_ -> "crs.ppa." ++ _ ->
process_dir0(Dir, Command, DirSet, Config, %% .app.src file
CurrentCodePath, ModuleSet) maybe_process_dir0(ModuleSetFile, ModuleSet,
end Config, CurrentCodePath, Dir,
Command, DirSet);
_ ->
%% not an app dir, no need to consider apps=/skip_apps=
process_dir0(Dir, Command, DirSet, Config,
CurrentCodePath, ModuleSet)
end. end.
maybe_process_dir0(AppFile, ModuleSet, Config, CurrentCodePath, maybe_process_dir0(AppFile, ModuleSet, Config, CurrentCodePath,