Skip to content

Commit

Permalink
Added nullptr check to PipelineFilter name and human_name
Browse files Browse the repository at this point in the history
Signed-off-by: Jared Duffey <[email protected]>
  • Loading branch information
JDuffeyBQ authored and imikejackson committed Apr 19, 2024
1 parent daf8c13 commit 0d2f7e9
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/Plugins/SimplnxCore/wrapping/python/simplnxpy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1373,9 +1373,27 @@ PYBIND11_MODULE(simplnx, mod)
pipelineFilter.def(
"get_filter", [](PipelineFilter& self) { return self.getFilter(); }, py::return_value_policy::reference_internal);
pipelineFilter.def(
"name", [](PipelineFilter& self) { return self.getFilter()->name(); }, "Returns the C++ name of the filter");
"name",
[](const PipelineFilter& self) {
const IFilter* filter = self.getFilter();
if(filter == nullptr)
{
throw std::runtime_error("PipelineFilter doesn't contain a filter (nullptr)");
}
return filter->name();
},
"Returns the C++ name of the filter");
pipelineFilter.def(
"human_name", [](PipelineFilter& self) { return self.getFilter()->humanName(); }, "Returns the human facing name of the filter");
"human_name",
[](const PipelineFilter& self) {
const IFilter* filter = self.getFilter();
if(filter == nullptr)
{
throw std::runtime_error("PipelineFilter doesn't contain a filter (nullptr)");
}
return filter->humanName();
},
"Returns the human facing name of the filter");

py::class_<PyFilter, IFilter> pyFilter(mod, "PyFilter");
pyFilter.def(py::init<>([](py::object object) { return std::make_unique<PyFilter>(std::move(object)); }));
Expand Down

0 comments on commit 0d2f7e9

Please sign in to comment.