summary refs log tree commit diff
path: root/chat.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-04 19:06:54 -0500
committerJune McEnroe <june@causal.agency>2020-02-04 19:06:54 -0500
commitf3fb466a31d78431a686981b7d9b718385591bce (patch)
treeeeaac9ef363fa585c7d574ec70eb9ae36fc7fa06 /chat.c
parentHandle signals in poll loop (diff)
downloadcatgirl-f3fb466a31d78431a686981b7d9b718385591bce.tar.gz
catgirl-f3fb466a31d78431a686981b7d9b718385591bce.zip
Only check revents if nfds > 0
If an error occurs, poll leaves the array unmodified.
Diffstat (limited to '')
-rw-r--r--chat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/chat.c b/chat.c
index 3aa4ad2..1656a53 100644
--- a/chat.c
+++ b/chat.c
@@ -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();
 	}