author | Myhailo Danylenko <isbear@ukrpost.net> |
Sun, 14 Oct 2012 18:06:50 +0200 | |
changeset 2035 | dac609275117 |
parent 2034 | c7d40b9b2bb9 |
child 2036 | f8958ab545ac |
--- a/mcabber/mcabber/compl.c Sun Oct 14 17:56:34 2012 +0200 +++ b/mcabber/mcabber/compl.c Sun Oct 14 18:06:50 2012 +0200 @@ -97,10 +97,11 @@ // as it is likely to change in future. guint compl_new_category(void) { + const guint maxcat = 8 * sizeof (registered_cats); guint i = 0; - while ((registered_cats >> i) & 1) + while ((registered_cats >> i) & 1 && i < maxcat) i++; - if (i >= 8 * sizeof (registered_cats)) + if (i >= maxcat) return 0; else { guint64 id = 1 << i;