diff --git a/src/osgPlugins/ply/plyfile.cpp b/src/osgPlugins/ply/plyfile.cpp index 3c7b386cd..c562add9c 100644 --- a/src/osgPlugins/ply/plyfile.cpp +++ b/src/osgPlugins/ply/plyfile.cpp @@ -1108,16 +1108,20 @@ void ply_get_property( elem = find_element (plyfile, elem_name); plyfile->which_elem = elem; - /* deposit the property information into the element's description */ - /* Properties may have several names, separated by | with no spaces */ - std::vector tokens; - tokenizeProperties(prop->name, tokens, "|"); - - for(std::vector::iterator it_property = tokens.begin(); - !prop_ptr && it_property != tokens.end(); - ++it_property) + if (elem) { - prop_ptr = find_property(elem, it_property->c_str(), &index); + + /* deposit the property information into the element's description */ + /* Properties may have several names, separated by | with no spaces */ + std::vector tokens; + tokenizeProperties(prop->name, tokens, "|"); + + for(std::vector::iterator it_property = tokens.begin(); + !prop_ptr && it_property != tokens.end(); + ++it_property) + { + prop_ptr = find_property(elem, it_property->c_str(), &index); + } } if(prop_ptr)