summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-08-18 16:30:25 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-08-18 21:08:40 +0100
commit42ed857640e7d506344713972e0cb6a971391a54 (patch)
treea1b77972f0edf85dfb6feac1cc5834e7585ab72e /sfx2/source
parent951ceab4016f183d8c8be15f50c12538aa196a50 (diff)
coverity#1371132 Unchecked dynamic_cast
Change-Id: I8df35ce69d4960d8f5529100ba705fd4d3cf684a
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/notebookbar/PriorityHBox.cxx10
1 files changed, 4 insertions, 6 deletions
diff --git a/sfx2/source/notebookbar/PriorityHBox.cxx b/sfx2/source/notebookbar/PriorityHBox.cxx
index 0b02f6325160..46f62827f254 100644
--- a/sfx2/source/notebookbar/PriorityHBox.cxx
+++ b/sfx2/source/notebookbar/PriorityHBox.cxx
@@ -121,12 +121,10 @@ public:
m_nNeededWidth += pChild->GetSizePixel().Width() + spacing;
// Add only containers which have explicitly assigned priority.
- if (pChild->GetType() == WINDOW_CONTAINER)
- {
- IPrioritable* pPrioritable = dynamic_cast<IPrioritable*>(pChild);
- if (pPrioritable->GetPriority() != VCL_PRIORITY_DEFAULT)
- m_aSortedChilds.push_back(pPrioritable);
- }
+ IPrioritable* pPrioritable = pChild->GetType() == WINDOW_CONTAINER ?
+ dynamic_cast<IPrioritable*>(pChild) : nullptr;
+ if (pPrioritable && pPrioritable->GetPriority() != VCL_PRIORITY_DEFAULT)
+ m_aSortedChilds.push_back(pPrioritable);
}
std::sort(m_aSortedChilds.begin(), m_aSortedChilds.end(), lcl_comparePriority);