Fix a crash if the client program tries to restore more modes than it saves

Fixes #1166
This commit is contained in:
Kovid Goyal 2018-11-22 08:57:43 +05:30
parent 0bb08d8bdd
commit 4ceb4cfc22
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -976,9 +976,9 @@ screen_restore_cursor(Screen *self) {
void
screen_restore_modes(Screen *self) {
ScreenModes *m;
const ScreenModes *m;
buffer_pop(&self->modes_savepoints, m);
if (m == NULL) *m = empty_modes;
if (m == NULL) m = &empty_modes;
#define S(name) set_mode_from_const(self, name, m->m##name)
S(DECTCEM); S(DECSCNM); S(DECSCNM); S(DECOM); S(DECAWM); S(DECARM); S(DECCKM);
S(BRACKETED_PASTE); S(FOCUS_TRACKING); S(EXTENDED_KEYBOARD);