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