Throw Exception when shape has invalid type

Although the switch statement handles all (current) allowed values, from
a C/C++ view point the enum may have any value of its underlying type.
In this case the function has no return statement and runs into
undefined behavior.

Fixes build failures when built with "-Werror=return-type".
This commit is contained in:
Stefan Brüns 2022-01-27 10:04:40 +01:00
parent 86fd2983c7
commit 54246e12ad

View File

@ -194,6 +194,7 @@ py::object CastShape(const TopoDS_Shape & s)
case TopAbs_SHAPE: case TopAbs_SHAPE:
return py::cast(s); return py::cast(s);
} }
throw Exception("Invalid Shape type");
}; };