Tests: add unit tests for:

* TopoShape::getElementTypeAndIndex
* ComplexGeoData::getTypeAndIndex

and fix crashes there when passing a null pointer
This commit is contained in:
wmayer
2023-08-25 15:54:48 +02:00
committed by wwmayer
parent 66fb1c7777
commit 2c2347f746
8 changed files with 116 additions and 2 deletions

View File

@@ -64,7 +64,7 @@ std::pair<std::string, unsigned long> ComplexGeoData::getTypeAndIndex(const char
boost::regex ex("^([^0-9]*)([0-9]*)$");
boost::cmatch what;
if (boost::regex_match(Name, what, ex)) {
if (Name && boost::regex_match(Name, what, ex)) {
element = what[1].str();
index = std::atoi(what[2].str().c_str());
}