summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRolf Eike Beer <kde@opensource.sf-tec.de>2012-06-06 15:40:32 (GMT)
committerRolf Eike Beer <kde@opensource.sf-tec.de>2012-06-06 15:41:35 (GMT)
commita3b0cb755ff08721a3b9e2c25d4aaf655fb40804 (patch)
tree8fdc87a2f10e93336235c88f46ca97a13400cea3
parent288d6673c08756c618acf3b27699a5b41a32047f (diff)
fix NULL-deref when new setting default key
Thanks to John Tapsell for spotting the line I have been looking at for weeks without seeing the bug. CCBUG:298465 CCMAIL:johnflux@gmail.com
-rw-r--r--model/kgpgitemmodel.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/model/kgpgitemmodel.cpp b/model/kgpgitemmodel.cpp
index 92207c6..d369346 100644
--- a/model/kgpgitemmodel.cpp
+++ b/model/kgpgitemmodel.cpp
@@ -343,8 +343,12 @@ KGpgItemModel::setDefaultKey(KGpgKeyNode *def)
emit dataChanged(createIndex(odefrow, 0, nd), createIndex(odefrow, lastcol, nd));
}
- m_default = def->getId();
- emit dataChanged(createIndex(defrow, 0, def), createIndex(defrow, lastcol, def));
+ if (def) {
+ m_default = def->getId();
+ emit dataChanged(createIndex(defrow, 0, def), createIndex(defrow, lastcol, def));
+ } else {
+ m_default.clear();
+ }
}
QModelIndex