patch 8.1.1259: crash when exiting early
Problem: Crash when exiting early. (Ralf Schandl)
Solution: Only pop/push the title when it was set. (closes #4334)
diff --git a/src/os_unix.c b/src/os_unix.c
index a78b330..ba5d386 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -2205,14 +2205,19 @@
void
mch_restore_title(int which)
{
+ int do_push_pop = did_set_title || did_set_icon;
+
/* only restore the title or icon when it has been set */
mch_settitle(((which & SAVE_RESTORE_TITLE) && did_set_title) ?
(oldtitle ? oldtitle : p_titleold) : NULL,
((which & SAVE_RESTORE_ICON) && did_set_icon) ? oldicon : NULL);
- // pop and push from/to the stack
- term_pop_title(which);
- term_push_title(which);
+ if (do_push_pop)
+ {
+ // pop and push from/to the stack
+ term_pop_title(which);
+ term_push_title(which);
+ }
}
#endif /* FEAT_TITLE */