summaryrefslogtreecommitdiffstats
path: root/Source/CursesDialog/cmCursesMainForm.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2008-03-07 21:32:09 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2008-03-07 21:32:09 (GMT)
commit354abb72d9de0fbcf7e02bc0aeb32f919b19ccac (patch)
tree2f5ec21e67926cb5b87e8b4da98a03f0c579d81a /Source/CursesDialog/cmCursesMainForm.cxx
parent22f12322bb0b6cae9755b065730e72db4d1d8973 (diff)
downloadCMake-354abb72d9de0fbcf7e02bc0aeb32f919b19ccac.zip
CMake-354abb72d9de0fbcf7e02bc0aeb32f919b19ccac.tar.gz
CMake-354abb72d9de0fbcf7e02bc0aeb32f919b19ccac.tar.bz2
ENH: fix it for working with an empty cache
Diffstat (limited to 'Source/CursesDialog/cmCursesMainForm.cxx')
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx17
1 files changed, 14 insertions, 3 deletions
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 01ab275..8946238 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -218,7 +218,6 @@ void cmCursesMainForm::RePost()
this->Form = 0;
}
delete[] this->Fields;
-
if (this->AdvancedMode)
{
this->NumberOfVisibleEntries = this->Entries->size();
@@ -239,7 +238,11 @@ void cmCursesMainForm::RePost()
this->NumberOfVisibleEntries++;
}
}
-
+ // there is always one even if it is the dummy one
+ if(this->NumberOfVisibleEntries == 0)
+ {
+ this->NumberOfVisibleEntries = 1;
+ }
// Assign the fields: 3 for each entry: label, new entry marker
// ('*' or ' ') and entry widget
this->Fields = new FIELD*[3*this->NumberOfVisibleEntries+1];
@@ -265,7 +268,15 @@ void cmCursesMainForm::RePost()
this->Fields[3*j+2] = (*it)->Entry->Field;
j++;
}
-
+ // if no cache entries there should still be one dummy field
+ if(j == 0)
+ {
+ it = this->Entries->begin();
+ this->Fields[0] = (*it)->Label->Field;
+ this->Fields[1] = (*it)->IsNewLabel->Field;
+ this->Fields[2] = (*it)->Entry->Field;
+ this->NumberOfVisibleEntries = 1;
+ }
// Has to be null terminated.
this->Fields[3*this->NumberOfVisibleEntries] = 0;
}