kernelshark: make sure ksmodels index is valid before use
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 kernelshark: make sure ksmodels index is valid before use
Pressing Ctrl+C with no data loaded will lead to a crash. Steps to reproduce:
Click in the trace viewer window.
Press Ctrl+C.
Signed-off-by Mircea Cirjaliu <[email protected]>
--- src/KsModels.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
src/KsModels.cpp +2 -1
@@ -309,7 +309,8 @@ QVariant KsViewModel::data(const QModelIndex &index, int role) const } if (role == Qt::DisplayRole) - return this->getValue(index.column(), index.row()); + if (index.isValid()) + return this->getValue(index.column(), index.row()); return {}; }
Signature · 1 line
2.43.0
The patch is applied. Thanks!
Yordan
Quoted 25 lines · Mircea Cirjaliu
Pressing Ctrl+C with no data loaded will lead to a crash. Steps to reproduce:
Click in the trace viewer window.
Press Ctrl+C.Signed-off-by Mircea Cirjaliu <[email protected]>--- src/KsModels.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)src/KsModels.cpp +2
-1@@ -309,7 +309,8 @@ QVariant KsViewModel::data(const QModelIndex &index, int role) const } if (role == Qt::DisplayRole) - return this->getValue(index.column(), index.row()); + if (index.isValid()) + return this->getValue(index.column(), index.row()); return {}; }