From d46f740a391aeb4d9a87f3437d92042093fef374 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 16 Nov 2007 22:03:26 +0100 Subject: [PATCH] check for int value in uicb_tag_toggleview() --- tag.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tag.c b/tag.c index 1b67eaef4..a26e4cc2b 100644 --- a/tag.c +++ b/tag.c @@ -142,14 +142,20 @@ void uicb_tag_toggleview(awesome_config *awesomeconf, const char *arg) { - unsigned int i; - int j; + int i, j; i = arg ? atoi(arg) - 1: 0; + + if(i >= awesomeconf->ntags) + return; + awesomeconf->tags[i].selected = !awesomeconf->tags[i].selected; + + /* check that there's at least one tag selected */ for(j = 0; j < awesomeconf->ntags && !awesomeconf->tags[j].selected; j++); if(j == awesomeconf->ntags) awesomeconf->tags[i].selected = True; + saveawesomeprops(awesomeconf); arrange(awesomeconf); }