Fix bug in new PVStructure::getAs function
Fix seg fault when getAs is called with a string of the form x.y (or x_1. ... x_n.y) where x or (x1. ... .x_i) is not a structure field. Signed-off-by: Dave Hickin <david.hickin@diamond.ac.uk>
This commit is contained in:
@@ -170,7 +170,7 @@ PVField* PVStructure::GetAsImpl(const char *name) const
|
||||
if(*sep) {
|
||||
// this is not the requested leaf
|
||||
parent = dynamic_cast<PVStructure*>(child);
|
||||
if(!child)
|
||||
if(!parent)
|
||||
throw std::runtime_error("mid-field is not a PVStructure"); //TODO: which sub field?
|
||||
child = NULL;
|
||||
name = sep+1; // skip past '.'
|
||||
|
||||
Reference in New Issue
Block a user