summaryrefslogtreecommitdiffstats
path: root/Source/CursesDialog/cmCursesMainForm.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2002-09-11 19:04:50 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2002-09-11 19:04:50 (GMT)
commit2ca71beb2a480e75be4443e1bf425afdc5edc973 (patch)
tree36852589ad1fcc3a274faac1df593f9cdce22905 /Source/CursesDialog/cmCursesMainForm.cxx
parentc41fe4f1790a8eade0edcdf66f0158e554c8e1ff (diff)
downloadCMake-2ca71beb2a480e75be4443e1bf425afdc5edc973.zip
CMake-2ca71beb2a480e75be4443e1bf425afdc5edc973.tar.gz
CMake-2ca71beb2a480e75be4443e1bf425afdc5edc973.tar.bz2
Fix problem with ccmake crashing on empty caches
Diffstat (limited to 'Source/CursesDialog/cmCursesMainForm.cxx')
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx49
1 files changed, 26 insertions, 23 deletions
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index c004cba..0db7ba0 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -450,32 +450,35 @@ void cmCursesMainForm::UpdateStatusBar()
FIELD* cur = current_field(m_Form);
int index = field_index(cur);
cmCursesWidget* lbl = reinterpret_cast<cmCursesWidget*>(field_userptr(
- m_Fields[index-2]));
- const char* curField = lbl->GetValue();
-
- // Get the help string of the current entry
- // and add it to the help string
- char help[128];
- cmCacheManager::CacheIterator it =
- this->m_CMakeInstance->GetCacheManager()->GetCacheIterator(curField);
- if (!it.IsAtEnd())
+ m_Fields[index-2]));
+ char help[128] = "";
+ const char* curField = "";
+ if ( lbl )
{
- const char* hs = it.GetProperty("HELPSTRING");
- if ( hs )
+ curField = lbl->GetValue();
+
+ // Get the help string of the current entry
+ // and add it to the help string
+ cmCacheManager::CacheIterator it =
+ this->m_CMakeInstance->GetCacheManager()->GetCacheIterator(curField);
+ if (!it.IsAtEnd())
{
- strncpy(help, hs, 127);
- help[127] = '\0';
+ const char* hs = it.GetProperty("HELPSTRING");
+ if ( hs )
+ {
+ strncpy(help, hs, 127);
+ help[127] = '\0';
+ }
+ else
+ {
+ help[0] = 0;
+ }
}
else
{
- help[0] = 0;
+ sprintf(help," ");
}
}
- else
- {
- sprintf(help," ");
- }
-
// Join the key, help string and pad with spaces
// (or truncate) as necessary
@@ -505,15 +508,15 @@ void cmCursesMainForm::UpdateStatusBar()
if (curFieldLen + helpLen + 2 >= width)
{
strncpy(bar+curFieldLen+2, help, width
- - curFieldLen - 2);
+ - curFieldLen - 2);
}
else
{
strcpy(bar+curFieldLen+2, help);
for(i=curFieldLen+helpLen+2; i < width; ++i)
- {
- bar[i] = ' ';
- }
+ {
+ bar[i] = ' ';
+ }
}
}