From 60e3030082b88090b4deb60ff55d5a1ad37194ed Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Mon, 3 Apr 2017 18:56:40 +0200 Subject: [PATCH] Valgrind: Check function early to avoid nullptr deref Change-Id: I19da2e8f9dd3f6d7af0d412e07a257ba33ecb680 Reviewed-by: hjk --- src/plugins/valgrind/callgrind/callgrindproxymodel.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/valgrind/callgrind/callgrindproxymodel.cpp b/src/plugins/valgrind/callgrind/callgrindproxymodel.cpp index 44df8fbbc8c..c1ac3840622 100644 --- a/src/plugins/valgrind/callgrind/callgrindproxymodel.cpp +++ b/src/plugins/valgrind/callgrind/callgrindproxymodel.cpp @@ -121,14 +121,17 @@ bool DataProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_ const Function *func = source_index.data(DataModel::FunctionRole).value(); + if (!func) + return false; + // check if func is located in the specific base directory, if any - if (func && !m_baseDir.isEmpty()) { + if (!m_baseDir.isEmpty()) { if (!func->location().startsWith(m_baseDir)) return false; } // check if the function from this index is a child of (called by) the filter function - if (func && m_function) { + if (m_function) { bool isValid = false; foreach (const FunctionCall *call, func->incomingCalls()) { if (call->caller() == m_function) {