From 17dbbda24f112068b0fdf0efec06c305222644c5 Mon Sep 17 00:00:00 2001 From: Miklos Marton Date: Tue, 10 Dec 2024 11:11:21 +0100 Subject: [PATCH] Remove redundant type check --- src/DataMaskRenderAreaComponent.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/DataMaskRenderAreaComponent.cpp b/src/DataMaskRenderAreaComponent.cpp index bf1880f..c79bb7f 100644 --- a/src/DataMaskRenderAreaComponent.cpp +++ b/src/DataMaskRenderAreaComponent.cpp @@ -190,17 +190,13 @@ void DataMaskRenderAreaComponent::mouseUp(const MouseEvent &event) if (clickedList->get_variable_reference() != isobus::NULL_OBJECT_ID) { - auto child = clickedList->get_object_by_id(clickedList->get_variable_reference(), parentWorkingSet->get_object_tree()); - if (isobus::VirtualTerminalObjectType::NumberVariable == child->get_object_type()) - { - auto child = clickedList->get_object_by_id(clickedList->get_variable_reference(), parentWorkingSet->get_object_tree()); + auto referencedVariable = clickedList->get_object_by_id(clickedList->get_variable_reference(), parentWorkingSet->get_object_tree()); - if (nullptr != child) + if (nullptr != referencedVariable) + { + if (isobus::VirtualTerminalObjectType::NumberVariable == referencedVariable->get_object_type()) { - if (isobus::VirtualTerminalObjectType::NumberVariable == child->get_object_type()) - { - selectedIndex = std::static_pointer_cast(child)->get_value(); - } + selectedIndex = std::static_pointer_cast(referencedVariable)->get_value(); } } }