[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdevplatform/plugins/sourceformatter
From:       Cédric Pasteur <cedric.pasteur () free ! fr>
Date:       2008-12-31 12:37:56
Message-ID: 1230727076.960857.10746.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 903723 by ccpasteur:

Do not crash if currentFormatter is null in settings dialog
It's weird I feel like I had already fixed that ...

BUG: 179190



 M  +10 -5     sourceformattersettings.cpp  


--- trunk/KDE/kdevplatform/plugins/sourceformatter/sourceformattersettings.cpp #903722:903723
@@ -212,7 +212,9 @@
 {
 	listStyles->clear();
 	//add predefined styles
-	QMap<QString, QString> map = m_currentFormatter->predefinedStyles(m_currentMimeType);
+	QMap<QString, QString> map;
+	if(m_currentFormatter)
+		m_currentFormatter->predefinedStyles(m_currentMimeType);
 	QMap<QString, QString>::const_iterator it = map.constBegin();
 	for (; it != map.constEnd(); ++it)
 		addItemInStyleList(it.value(), it.key());
@@ -363,7 +365,8 @@
 	populateStyleList();
 
 	//update description label
-	lblDescription->setText(m_currentFormatter->description());
+	if(m_currentFormatter)
+		lblDescription->setText(m_currentFormatter->description());
 	updatePreviewText();
 	changed();
 }
@@ -376,9 +379,11 @@
 
 	m_currentFormatter = manager->activeFormatter();
 	m_currentMimeType = KMimeType::mimeType(manager->mimeTypeForLanguage(lang));
-	m_previewText = m_currentFormatter->previewText(m_currentMimeType);
-	QString mode = m_currentFormatter->highlightModeForMime(m_currentMimeType);
-	m_document->setHighlightingMode(mode);
+	if(m_currentFormatter) {
+		m_previewText = m_currentFormatter->previewText(m_currentMimeType);
+		QString mode = m_currentFormatter->highlightModeForMime(m_currentMimeType);
+		m_document->setHighlightingMode(mode);
+	}
 	m_currentLang = lang;
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic