Fix a crash when swapping no characters in history

Signed-off-by: Gavin Howard <[email protected]>
This commit is contained in:
Gavin Howard 2022-12-10 13:15:33 -07:00
parent fa40b9f963
commit 61e990a400
Signed by: gavin
GPG Key ID: 93D31C8CA4AB6C63
1 changed files with 3 additions and 0 deletions

View File

@ -1467,6 +1467,9 @@ bc_history_swap(BcHistory* h)
BC_SIG_ASSERT_LOCKED;
// If there are no characters, skip.
if (!h->pos) return;
// Get the length of the previous and next characters.
pcl = bc_history_prevLen(h->buf.v, h->pos);
ncl = bc_history_nextLen(h->buf.v, BC_HIST_BUF_LEN(h), h->pos, NULL);