fixed a bug

This commit is contained in:
mrkraimer
2019-07-17 10:43:13 -04:00
parent ddb36536fe
commit a91ba8ef9e
2 changed files with 8 additions and 5 deletions

View File

@ -617,7 +617,7 @@ public:
*
* Accepts arguments of the form field='value' where value is json syntax.
* field is name.name...
* @parm args The arguments
* @param args The arguments
* @throw runtime_error if failure.
*/
void parse(const std::vector<std::string> &args);

View File

@ -156,19 +156,22 @@ void PvaClientData::parse(const std::vector<std::string> &args)
if(!pvStructure) throw std::runtime_error(messagePrefix + noStructure);
if(!bitSet) throw std::runtime_error(messagePrefix + noStructure);
size_t num = args.size();
if(num<1) throw std::runtime_error(messagePrefix + " no arguments");
for(size_t i=0; i<num; ++i)
{
string val = args[i];
size_t iequals = val.find_first_of('=');
string field;
string rest(val);
if(iequals!=std::string::npos) {
field = val.substr(0,iequals);
rest = val.substr(iequals+1);
if(iequals==std::string::npos) {
parse(rest,pvStructure,bitSet);
continue;
}
field = val.substr(0,iequals);
rest = val.substr(iequals+1);
if(field.size()==std::string::npos) {
parse(rest,pvStructure,bitSet);
return;
continue;
}
PVFieldPtr pvField(pvStructure->getSubField(field));
// look for enumerated structure