changeset 198:864b5a251ab5

http://universalindent.sf.net/issue/1733499 UniversalIndentGUI crashed if the category number inside the indenter config ini was higher than the available categories. git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@406 59b1889a-e5ac-428c-b0c7-476e01d41282
author thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
date Fri, 08 Jun 2007 21:20:18 +0000
parents de8808be3460
children 6d8db1c2154b
files src/indenthandler.cpp
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/indenthandler.cpp	Fri Jun 08 16:57:33 2007 +0000
+++ b/src/indenthandler.cpp	Fri Jun 08 21:20:18 2007 +0000
@@ -636,6 +636,10 @@
     // read the categories names which are separated by "|"
     QString categoriesStr = indenterSettings->value(" header/categories").toString();
     categories = categoriesStr.split("|");
+	// Assure that the category list is never empty. At least contain a "general" section.
+	if ( categories.isEmpty() ) {
+		categories.append("General");
+	}
 
     ToolBoxPage toolBoxPage;
 
@@ -671,6 +675,10 @@
         if ( indenterParameter != " header") {
             // read to which category the parameter belongs
             int category = indenterSettings->value(indenterParameter + "/Category").toInt();
+			// Assure that the category number is never greater than the available categories.
+            if ( category > toolBoxPages.size()-1 ) {
+                category = toolBoxPages.size()-1;
+            }
             // read which type of input field the parameter needs
             QString editType = indenterSettings->value(indenterParameter + "/EditorType").toString();