1
0
mirror of https://github.com/Cloudef/bemenu synced 2024-11-23 17:32:11 +01:00

It's better to guard whole function.

This commit is contained in:
Jari Vetoniemi 2014-04-15 20:07:47 +03:00
parent cf27013c1d
commit f77ae857b1

@ -252,6 +252,9 @@ static unsigned int _bmDrawCursesDisplayedCount(const bmMenu *menu)
static void _bmDrawCursesEndWin(void)
{
if (!curses.stdscr)
return;
freopen(TTY, "w", stdout);
if (curses.refresh)
@ -260,12 +263,10 @@ static void _bmDrawCursesEndWin(void)
if (curses.endwin)
curses.endwin();
if (curses.stdscr) {
dup2(curses.oldStdin, STDIN_FILENO);
dup2(curses.oldStdout, STDOUT_FILENO);
close(curses.oldStdin);
close(curses.oldStdout);
}
dup2(curses.oldStdin, STDIN_FILENO);
dup2(curses.oldStdout, STDOUT_FILENO);
close(curses.oldStdin);
close(curses.oldStdout);
curses.stdscr = NULL;
}