[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kmouth/noqt3support] phrasebook: Guard against invalid pointers in PhraseBookDialog.
From: Jeremy Whiting <jpwhiting () kde ! org>
Date: 2015-05-01 4:46:48
Message-ID: E1Yo2qe-0007Wy-8f () scm ! kde ! org
[Download RAW message or body]
Git commit 9ecef2f11150eec55b52314400ac204f506ef25c by Jeremy Whiting.
Committed on 01/05/2015 at 04:46.
Pushed by whiting into branch 'noqt3support'.
Guard against invalid pointers in PhraseBookDialog.
M +9 -3 phrasebook/phrasebookdialog.cpp
http://commits.kde.org/kmouth/9ecef2f11150eec55b52314400ac204f506ef25c
diff --git a/phrasebook/phrasebookdialog.cpp b/phrasebook/phrasebookdialog.cpp
index c7d7835..6ef16f3 100644
--- a/phrasebook/phrasebookdialog.cpp
+++ b/phrasebook/phrasebookdialog.cpp
@@ -525,7 +525,7 @@ QModelIndex PhraseBookDialog::getCurrentParent()
{
QModelIndex currentIndex = m_ui->treeView->currentIndex();
QStandardItem *item = m_bookModel->itemFromIndex(currentIndex);
- if (!item->isDropEnabled()) // If it's not a book
+ if (item != NULL && !item->isDropEnabled()) // If it's not a book
currentIndex = currentIndex.parent();
return currentIndex;
}
@@ -547,7 +547,10 @@ void PhraseBookDialog::slotAddPhrasebook () {
QList<QStandardItem*> items;
items << item << shortcutItem;
- parent->appendRow(items);
+ if (parent)
+ parent->appendRow(items);
+ else
+ m_bookModel->appendRow(items);
focusNewItem(parentIndex, item);
}
@@ -562,7 +565,10 @@ void PhraseBookDialog::slotAddPhrase () {
QList<QStandardItem*> items;
items << item << shortcutItem;
- parent->appendRow(items);
+ if (parent)
+ parent->appendRow(items);
+ else
+ m_bookModel->appendRow(items);
focusNewItem(parentIndex, item);
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic