BUG: Prevent crash when deleting the last cache item
This commit is contained in:
parent
2ccce878a3
commit
183273bea2
@ -241,6 +241,11 @@ void cmCursesMainForm::RePost()
|
|||||||
// Assign the fields: 3 for each entry: label, new entry marker
|
// Assign the fields: 3 for each entry: label, new entry marker
|
||||||
// ('*' or ' ') and entry widget
|
// ('*' or ' ') and entry widget
|
||||||
m_Fields = new FIELD*[3*m_NumberOfVisibleEntries+1];
|
m_Fields = new FIELD*[3*m_NumberOfVisibleEntries+1];
|
||||||
|
int cc;
|
||||||
|
for ( cc = 0; cc < 3 * m_NumberOfVisibleEntries+1; cc ++ )
|
||||||
|
{
|
||||||
|
m_Fields[cc] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Assign fields
|
// Assign fields
|
||||||
int j=0;
|
int j=0;
|
||||||
@ -1096,8 +1101,11 @@ void cmCursesMainForm::HandleInput()
|
|||||||
// each entry consists of fields: label, isnew, value
|
// each entry consists of fields: label, isnew, value
|
||||||
// therefore, the label field for the is findex-2
|
// therefore, the label field for the is findex-2
|
||||||
// (findex always corresponds to the value field)
|
// (findex always corresponds to the value field)
|
||||||
cmCursesWidget* lbl = reinterpret_cast<cmCursesWidget*>(field_userptr(
|
cmCursesWidget* lbl
|
||||||
m_Fields[findex-2]));
|
= reinterpret_cast<cmCursesWidget*>(
|
||||||
|
field_userptr(m_Fields[findex-2]));
|
||||||
|
if ( lbl )
|
||||||
|
{
|
||||||
this->m_CMakeInstance->GetCacheManager()->RemoveCacheEntry(lbl->GetValue());
|
this->m_CMakeInstance->GetCacheManager()->RemoveCacheEntry(lbl->GetValue());
|
||||||
|
|
||||||
std::string nextVal;
|
std::string nextVal;
|
||||||
@ -1131,6 +1139,7 @@ void cmCursesMainForm::HandleInput()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
touchwin(stdscr);
|
touchwin(stdscr);
|
||||||
wrefresh(stdscr);
|
wrefresh(stdscr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user