[hackers] [tabbed] Fix movetab and focusurgent when there's no client || Caleb Malchik

From: <git_AT_suckless.org>
Date: Mon, 8 May 2017 09:10:41 +0200 (CEST)

commit 6dc3978edf56ef6760ed818e29eb920138b09802
Author: Caleb Malchik <cmalchik_AT_gmail.com>
AuthorDate: Sun May 7 18:08:37 2017 -0700
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Mon May 8 08:58:45 2017 +0200

    Fix movetab and focusurgent when there's no client
    
    Accessing those would crash with a floating point exception.

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

This archive was generated by hypermail 2.3.0 : Mon May 08 2017 - 09:12:22 CEST