Fix the out of bounds of array
This commit is contained in:
committed by
Raphael Coeffic
parent
ba81224806
commit
e487273ce9
@@ -209,6 +209,7 @@ void TextEdit::onEvent(event_t event)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EVT_KEY_BREAK(KEY_PGDN):
|
case EVT_KEY_BREAK(KEY_PGDN):
|
||||||
|
if (cursorPos < length) {
|
||||||
memmove(&value[cursorPos], &value[cursorPos + 1], length - cursorPos - 1);
|
memmove(&value[cursorPos], &value[cursorPos + 1], length - cursorPos - 1);
|
||||||
value[length - 1] = '\0';
|
value[length - 1] = '\0';
|
||||||
changed = true;
|
changed = true;
|
||||||
@@ -216,6 +217,7 @@ void TextEdit::onEvent(event_t event)
|
|||||||
cursorPos = cursorPos - 1;
|
cursorPos = cursorPos - 1;
|
||||||
}
|
}
|
||||||
invalidate();
|
invalidate();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user