Further resolve CID 1222223

Previous fix only addressed one of the two issues. The problem is `->Attribute("name")` can return a null pointer which was then blindly passed into `std::string` constructor.