[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [libkpeople] src: Add some asserts to make sure we crash when something is weird
From: Aleix Pol <aleixpol () kde ! org>
Date: 2013-06-11 16:38:53
Message-ID: 20130611163853.54576A6067 () git ! kde ! org
[Download RAW message or body]
Git commit e194cf73d4d6cb358b0b5faf913c463f2a13024c by Aleix Pol.
Committed on 11/06/2013 at 18:28.
Pushed by apol into branch 'master'.
Add some asserts to make sure we crash when something is weird
I had some crashes in QML that gave me weird crashes in Nepomuk code, it
doesn't hurt I'd say
M +2 -1 src/personsmodel.cpp
http://commits.kde.org/libkpeople/e194cf73d4d6cb358b0b5faf913c463f2a13024c
diff --git a/src/personsmodel.cpp b/src/personsmodel.cpp
index c7cec0d..5245110 100644
--- a/src/personsmodel.cpp
+++ b/src/personsmodel.cpp
@@ -467,6 +467,7 @@ ContactItem* PersonsModel::contactForIMAccount(const QUrl &uri) const
void PersonsModel::createPersonFromContacts(const QList<QUrl> &contacts)
{
+ Q_ASSERT(!contacts.isEmpty());
Nepomuk2::SimpleResource newPimoPerson;
newPimoPerson.addType(Nepomuk2::Vocabulary::PIMO::Person());
@@ -484,10 +485,10 @@ void PersonsModel::createPersonFromContacts(const QList<QUrl> &contacts)
void PersonsModel::createPersonFromIndexes(const QList<QModelIndex> &indexes)
{
+ Q_ASSERT(!indexes.isEmpty());
QList<QUrl> personUris;
QList<QUrl> contactUris;
-
Q_FOREACH(const QModelIndex &index, indexes) {
if (index.data(PersonsModel::ResourceTypeRole).toUInt() == PersonsModel::Person) {
personUris.append(index.data(PersonsModel::UriRole).toUrl());
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic