Fix crash caused if a unicode combing character is sent before any text

This commit is contained in:
Kovid Goyal 2017-11-01 11:12:22 +05:30
parent 4098b33bb7
commit 27a1f27e59
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -320,6 +320,7 @@ width(Line *self, PyObject *val) {
void
line_add_combining_char(Line *self, uint32_t ch, unsigned int x) {
if (!self->cells[x].ch) return; // dont allow adding combining chars to a null cell
combining_type c = self->cells[x].cc;
if (c & CC_MASK) self->cells[x].cc = (c & CC_MASK) | ( (ch & CC_MASK) << CC_SHIFT );
else self->cells[x].cc = ch & CC_MASK;