forked from qt-creator/qt-creator
Valgrind: Check function early to avoid nullptr deref
Change-Id: I19da2e8f9dd3f6d7af0d412e07a257ba33ecb680 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -121,14 +121,17 @@ bool DataProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_
|
|||||||
|
|
||||||
const Function *func = source_index.data(DataModel::FunctionRole).value<const Function *>();
|
const Function *func = source_index.data(DataModel::FunctionRole).value<const Function *>();
|
||||||
|
|
||||||
|
if (!func)
|
||||||
|
return false;
|
||||||
|
|
||||||
// check if func is located in the specific base directory, if any
|
// 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))
|
if (!func->location().startsWith(m_baseDir))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if the function from this index is a child of (called by) the filter function
|
// 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;
|
bool isValid = false;
|
||||||
foreach (const FunctionCall *call, func->incomingCalls()) {
|
foreach (const FunctionCall *call, func->incomingCalls()) {
|
||||||
if (call->caller() == m_function) {
|
if (call->caller() == m_function) {
|
||||||
|
Reference in New Issue
Block a user