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.
---
src/KsModels.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
src/KsModels.cpp +0 -0
@@ -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
Hi Mircea,
There are two issues with this patch.
First, please provide more detailed instruction how to reproduce the problem, because I tried "Pressing Ctrl+C with no data loaded" and I see no crash. Nevertheless, the change you suggest looks like a valid fix to me.
The second issue is that the patch itself fails to apply.
My guess is that your Yahoo mail server is messing the text encoding of the patch resulting in git rejecting it.
Cheers,
Yordan
Quoted 22 lines · Mircea Cirjaliu
Pressing Ctrl+C with no data loaded will lead to a crash.
Signed-off-by Mircea Cirjaliu <[email protected]>--- src/KsModels.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)src/KsModels.cpp +0
-0@@ -309,7 +309,8 @@ QVariant KsViewModel::data(const QModelIndex &index,int role) const
}if (role ==
Qt::DisplayRole)
- returnthis->getValue(index.column(), index.row()); + if (index.isValid())
+ returnthis->getValue(index.column(), index.row());return {};
}