From 93090fa55b19e46e81014292d7f62308014ad79a Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 29 Aug 2023 00:45:27 +0200 Subject: [PATCH] Gui: no need to check for nullptr when using dynamic_cast It's explicitly allowed to use dynamic_cast on a nullptr and the result will be a nullptr too. See https://en.cppreference.com/w/cpp/language/dynamic_cast --- src/Gui/SoFCSelectionContext.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/Gui/SoFCSelectionContext.cpp b/src/Gui/SoFCSelectionContext.cpp index 029aec9778..63cf241841 100644 --- a/src/Gui/SoFCSelectionContext.cpp +++ b/src/Gui/SoFCSelectionContext.cpp @@ -181,12 +181,7 @@ int SoFCSelectionContextEx::merge(int status, SoFCSelectionContextBasePtr &outpu SoFCSelectionContextBasePtr input, SoNode *node) { auto ctx = std::dynamic_pointer_cast(input); - SoFCSelectionRoot* selectionNode; - if (node == nullptr) { - selectionNode = nullptr; - } else { - selectionNode = dynamic_cast(node); - } + SoFCSelectionRoot* selectionNode = dynamic_cast(node); if(!ctx) { if(selectionNode && selectionNode->hasColorOverride()) {