Only check revents if nfds > 0

If an error occurs, poll leaves the array unmodified.
weechat-hashes
C. McEnroe 2020-02-04 19:06:54 -05:00
parent 5e9863fa82
commit f3fb466a31
1 changed files with 3 additions and 3 deletions

6
chat.c
View File

@ -125,11 +125,11 @@ int main(int argc, char *argv[]) {
if (signals[SIGWINCH]) {
signals[SIGWINCH] = 0;
cursesWinch(SIGWINCH);
fds[0].revents = POLLIN;
uiRead();
}
if (fds[0].revents) uiRead();
if (fds[1].revents) ircRecv();
if (nfds > 0 && fds[0].revents) uiRead();
if (nfds > 0 && fds[1].revents) ircRecv();
uiDraw();
}