+fix: crash on accessing UndoRedo selection history while instance has not been initialized.

This commit is contained in:
Rainer Kottenhoff 2017-10-15 18:46:35 +02:00
parent 48d008c181
commit 6cb00e36d2

View File

@ -7390,18 +7390,19 @@ void RestoreSelectionAction(int token, DoAction doAct)
int UndoRedoSelectionMap(int token, UndoRedoSelection_t* selection)
{
if (UndoRedoSelectionUTArray == NULL)
return -1;
static unsigned int iTokenCnt = 0;
// indexing is unsigned
unsigned int utoken = (token >= 0) ? (unsigned int)token : 0U;
if (selection == NULL) {
// reset / clear
SendMessage(hwndEdit,SCI_EMPTYUNDOBUFFER,0,0);
if (UndoRedoSelectionUTArray != NULL) {
utarray_clear(UndoRedoSelectionUTArray);
utarray_init(UndoRedoSelectionUTArray,&UndoRedoSelection_icd);
}
utarray_clear(UndoRedoSelectionUTArray);
utarray_init(UndoRedoSelectionUTArray,&UndoRedoSelection_icd);
iTokenCnt = 0U;
return -1;
}