pvput: make sure we have valid values after all the checks

This commit is contained in:
Jesus Vasquez
2021-03-08 19:32:01 -08:00
committed by mdavidsaver
parent 674264db3d
commit f72c7e653c

View File

@ -138,6 +138,9 @@ struct Putter : public pvac::ClientChannel::PutCallback
if(!bare.empty() && !pairs.empty()) { if(!bare.empty() && !pairs.empty()) {
throw std::runtime_error("Can't mix bare values and field=value pairs"); throw std::runtime_error("Can't mix bare values and field=value pairs");
} else if(bare.empty() && pairs.empty()) {
// We could have ignored all the value at this point
throw std::runtime_error("No valid value(s) specified");
} else if(bare.size()==1 && bare[0][0]=='[') { } else if(bare.size()==1 && bare[0][0]=='[') {
// treat plain "[...]" as "value=[...]" // treat plain "[...]" as "value=[...]"
pairs.push_back(std::make_pair("value", bare[0])); pairs.push_back(std::make_pair("value", bare[0]));