Fix problem with ccmake crashing on empty caches
This commit is contained in:
parent
c41fe4f179
commit
2ca71beb2a
@ -450,32 +450,35 @@ void cmCursesMainForm::UpdateStatusBar()
|
|||||||
FIELD* cur = current_field(m_Form);
|
FIELD* cur = current_field(m_Form);
|
||||||
int index = field_index(cur);
|
int index = field_index(cur);
|
||||||
cmCursesWidget* lbl = reinterpret_cast<cmCursesWidget*>(field_userptr(
|
cmCursesWidget* lbl = reinterpret_cast<cmCursesWidget*>(field_userptr(
|
||||||
m_Fields[index-2]));
|
m_Fields[index-2]));
|
||||||
const char* curField = lbl->GetValue();
|
char help[128] = "";
|
||||||
|
const char* curField = "";
|
||||||
// Get the help string of the current entry
|
if ( lbl )
|
||||||
// and add it to the help string
|
|
||||||
char help[128];
|
|
||||||
cmCacheManager::CacheIterator it =
|
|
||||||
this->m_CMakeInstance->GetCacheManager()->GetCacheIterator(curField);
|
|
||||||
if (!it.IsAtEnd())
|
|
||||||
{
|
{
|
||||||
const char* hs = it.GetProperty("HELPSTRING");
|
curField = lbl->GetValue();
|
||||||
if ( hs )
|
|
||||||
|
// 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);
|
const char* hs = it.GetProperty("HELPSTRING");
|
||||||
help[127] = '\0';
|
if ( hs )
|
||||||
|
{
|
||||||
|
strncpy(help, hs, 127);
|
||||||
|
help[127] = '\0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
help[0] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
help[0] = 0;
|
sprintf(help," ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
sprintf(help," ");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Join the key, help string and pad with spaces
|
// Join the key, help string and pad with spaces
|
||||||
// (or truncate) as necessary
|
// (or truncate) as necessary
|
||||||
@ -505,15 +508,15 @@ void cmCursesMainForm::UpdateStatusBar()
|
|||||||
if (curFieldLen + helpLen + 2 >= width)
|
if (curFieldLen + helpLen + 2 >= width)
|
||||||
{
|
{
|
||||||
strncpy(bar+curFieldLen+2, help, width
|
strncpy(bar+curFieldLen+2, help, width
|
||||||
- curFieldLen - 2);
|
- curFieldLen - 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(bar+curFieldLen+2, help);
|
strcpy(bar+curFieldLen+2, help);
|
||||||
for(i=curFieldLen+helpLen+2; i < width; ++i)
|
for(i=curFieldLen+helpLen+2; i < width; ++i)
|
||||||
{
|
{
|
||||||
bar[i] = ' ';
|
bar[i] = ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user