torbuilder(importer) fix badarith bug when there're invalid name torrent

files
This commit is contained in:
Kevin Lynx 2013-07-11 09:05:54 +08:00
parent ae9f2f0c8e
commit f776cbbc46

View File

@ -94,13 +94,15 @@ parse_hash(FileName) ->
append_torrent_names(FP, [Name|Rest]) -> append_torrent_names(FP, [Name|Rest]) ->
Hash = parse_hash(Name), Hash = parse_hash(Name),
case length(Hash) == 40 of This = case length(Hash) == 40 of
true -> true ->
io:format(FP, "~s~n", [Name]) , io:format(FP, "~s~n", [Name]),
1 + append_torrent_names(FP, Rest); 1;
false -> false ->
?W(?FMT("invalid torrent file name ~s", [Name])) ?W(?FMT("invalid torrent file name ~s", [Name])),
end; 0
end,
This + append_torrent_names(FP, Rest);
append_torrent_names(_, []) -> append_torrent_names(_, []) ->
0. 0.