Avoid passing NULL pointers to curses functions.

This allows profanity to work without segfaulting from NULL
pointer dereferences when used with NetBSD libcurses.

Basic functionality was tested, there may be more NULL pointer
issues hiding.
This commit is contained in:
nia
2020-09-04 12:59:20 +02:00
parent 52e9be4abc
commit ce67753423
3 changed files with 23 additions and 9 deletions

View File

@@ -1863,7 +1863,12 @@ win_sub_print(WINDOW* win, char* msg, gboolean newline, gboolean wrap, int inden
void
win_sub_newline_lazy(WINDOW* win)
{
int curx = getcurx(win);
int curx;
if (win == NULL) {
return;
}
curx = getcurx(win);
if (curx > 0) {
int cury = getcury(win);
wmove(win, cury + 1, 0);