[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [calligra/calligra/2.6] plugins/textshape/dialogs: Make the code to get a style a bit safer
From: Boudewijn Rempt <boud () valdyas ! org>
Date: 2013-06-24 13:52:21
Message-ID: E1Ur7Bt-0000zc-Ha () scm ! kde ! org
[Download RAW message or body]
Git commit 80206520d23ad8f9d80d0f76c647edc4541959d0 by Boudewijn Rempt.
Committed on 24/06/2013 at 13:51.
Pushed by rempt into branch 'calligra/2.6'.
Make the code to get a style a bit safer
BUG:317302
M +13 -2 plugins/textshape/dialogs/CharacterGeneral.cpp
http://commits.kde.org/calligra/80206520d23ad8f9d80d0f76c647edc4541959d0
diff --git a/plugins/textshape/dialogs/CharacterGeneral.cpp \
b/plugins/textshape/dialogs/CharacterGeneral.cpp index 5c0edc5..9f20fe6 100644
--- a/plugins/textshape/dialogs/CharacterGeneral.cpp
+++ b/plugins/textshape/dialogs/CharacterGeneral.cpp
@@ -172,6 +172,9 @@ void CharacterGeneral::setStyleManager(KoStyleManager *sm)
void CharacterGeneral::updateNextStyleCombo(KoParagraphStyle *style)
{
+ if (!style)
+ return;
+
widget.nextStyle->setCurrentIndex(m_paragraphStyleModel->indexForParagraphStyle(*style).row());
m_paragraphStyleModel->setCurrentParagraphStyle(style->styleId());
}
@@ -181,8 +184,16 @@ int CharacterGeneral::nextStyleId()
if (!m_styleManager) {
return 0;
}
-
- return m_styleManager->paragraphStyle(m_paragraphStyleModel->index(widget.nextStyle->currentIndex()).internalId())->styleId();
+ int nextStyleIndex = widget.nextStyle->currentIndex();
+ QModelIndex paragraphStyleIndex = m_paragraphStyleModel->index(nextStyleIndex);
+ quint64 internalId = paragraphStyleIndex.internalId();
+ KoParagraphStyle * paragraphStyle = m_styleManager->paragraphStyle(internalId);
+ if (paragraphStyle) {
+ return paragraphStyle->styleId();
+ }
+ else {
+ return 0;
+ }
}
KoCharacterStyle *CharacterGeneral::style() const
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic