[hackers] [tabbed][PATCH] Fix crashes when nclients == 0 in movetab() and focusurgent()

From: Caleb Malchik <cmalchik_AT_gmail.com>
Date: Sun, 7 May 2017 18:08:37 -0700

---
 tabbed.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff --git a/tabbed.c b/tabbed.c
index 6321575..23c3b47 100644
--- a/tabbed.c
+++ b/tabbed.c
_AT_@ -502,6 +502,9 @@ focusurgent(const Arg *arg)
 {
 	int c;
 
+	if (nclients == 0)
+		return;
+
 	for (c = (sel + 1) % nclients; c != sel; c = (c + 1) % nclients) {
 		if (clients[c]->urgent) {
 			focus(c);
_AT_@ -785,6 +788,9 @@ movetab(const Arg *arg)
 	int c;
 	Client *new;
 
+	if (nclients == 0)
+		return;
+
 	c = (sel + arg->i) % nclients;
 	if (c < 0)
 		c += nclients;
-- 
2.12.2
Received on Mon May 08 2017 - 03:08:37 CEST

This archive was generated by hypermail 2.3.0 : Mon May 08 2017 - 03:12:18 CEST