With this you are standing that mysearch.getPath()
could be null:
if (mysearch.getPath() == NULL) {
std::cout<<"No property of this type was found";
}
but below you are using that without any check:
SoPath* mypath=mysearch.getPath();
return mypath->getTail();
so this can raise an Unhandled Exception.
Another poitn is the line:
std::cout<<" " <<s->getValue()[25]; // Some point
There is no check about how many points are in the vector, and this as well could cause an exception.