mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-17 06:36:18 +00:00
Reject a throttle rate that does not parse
A discarded parse result left the rate at zero, which is unlimited.
This commit is contained in:
@@ -83,7 +83,9 @@ apply_throttle(const torrent::Object::list_type& args, bool up) {
|
|||||||
throw torrent::input_error("Missing throttle rate for '" + name + "'.");
|
throw torrent::input_error("Missing throttle rate for '" + name + "'.");
|
||||||
|
|
||||||
int64_t rate;
|
int64_t rate;
|
||||||
rpc::parse_whole_value_nothrow(arg_itr->as_string().c_str(), &rate);
|
|
||||||
|
if (!rpc::parse_whole_value_nothrow(arg_itr->as_string().c_str(), &rate))
|
||||||
|
throw torrent::input_error("Invalid throttle rate for '" + name + "'.");
|
||||||
|
|
||||||
if (rate < 0)
|
if (rate < 0)
|
||||||
throw torrent::input_error("Throttle rate must be non-negative.");
|
throw torrent::input_error("Throttle rate must be non-negative.");
|
||||||
|
|||||||
Reference in New Issue
Block a user