Skip to content

Commit 227b80d

Browse files
committed
Use smart pointers instead of raw pointers
1 parent 79bf163 commit 227b80d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Framework/CurveFitting/src/Functions/BSpline.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,18 @@ void BSpline::resetValidators() {
6161
auto attStartX = getAttribute("StartX");
6262
auto attEndX = getAttribute("EndX");
6363

64-
auto startXValidator = dynamic_cast<BoundedValidator<double> *>(attStartX.getValidator().get());
64+
auto startXValidator = std::dynamic_pointer_cast<BoundedValidator<double>>(attStartX.getValidator());
6565
startXValidator->setUpper(attEndX.asDouble());
6666

67-
auto endXValidator = dynamic_cast<BoundedValidator<double> *>(attEndX.getValidator().get());
67+
auto endXValidator = std::dynamic_pointer_cast<BoundedValidator<double>>(attEndX.getValidator());
6868
endXValidator->setLower(attStartX.asDouble());
6969

7070
auto breakPointsValidator =
71-
dynamic_cast<ArrayBoundedValidator<double> *>(getAttribute("BreakPoints").getValidator().get());
72-
breakPointsValidator->setLower(attStartX.asDouble());
73-
breakPointsValidator->setUpper(attEndX.asDouble());
71+
dynamic_pointer_cast<ArrayBoundedValidator<double>>(getAttribute("BreakPoints").getValidator());
72+
if (breakPointsValidator != nullptr) {
73+
breakPointsValidator->setLower(attStartX.asDouble());
74+
breakPointsValidator->setUpper(attEndX.asDouble());
75+
}
7476
}
7577

7678
/** Execute the function

0 commit comments

Comments
 (0)