mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-11 00:29:22 +00:00
Merge branch 'throttle_args_fix' of https://github.com/chros73/rtorrent into chros73-throttle_args_fix
This commit is contained in:
@@ -96,12 +96,15 @@ torrent::Object
|
|||||||
apply_throttle(const torrent::Object::list_type& args, bool up) {
|
apply_throttle(const torrent::Object::list_type& args, bool up) {
|
||||||
torrent::Object::list_const_iterator argItr = args.begin();
|
torrent::Object::list_const_iterator argItr = args.begin();
|
||||||
|
|
||||||
|
if (argItr == args.end())
|
||||||
|
throw torrent::input_error("Missing throttle name.");
|
||||||
|
|
||||||
const std::string& name = argItr->as_string();
|
const std::string& name = argItr->as_string();
|
||||||
if (name.empty() || name == "NULL")
|
if (name.empty() || name == "NULL")
|
||||||
throw torrent::input_error("Invalid throttle name.");
|
throw torrent::input_error("Invalid throttle name '" + name + "'.");
|
||||||
|
|
||||||
if ((++argItr)->as_string().empty())
|
if (++argItr == args.end() || argItr->as_string().empty())
|
||||||
return torrent::Object();
|
throw torrent::input_error("Missing throttle rate for '" + name + "'.");
|
||||||
|
|
||||||
int64_t rate;
|
int64_t rate;
|
||||||
rpc::parse_whole_value_nothrow(argItr->as_string().c_str(), &rate);
|
rpc::parse_whole_value_nothrow(argItr->as_string().c_str(), &rate);
|
||||||
|
|||||||
Reference in New Issue
Block a user