diff --git a/hive/db/sql_scripts/community_helpers.sql b/hive/db/sql_scripts/community_helpers.sql
index 4fd9813639bdfde2fca32f79ebaa63042d716178..7b8d2659a8acc2d57ce7f3d9210022aeb036b376 100644
--- a/hive/db/sql_scripts/community_helpers.sql
+++ b/hive/db/sql_scripts/community_helpers.sql
@@ -9,12 +9,14 @@ declare
         __role_id SMALLINT;
 BEGIN
         SELECT id INTO __subscription_id FROM hive_subscriptions WHERE account_id = _account_id AND community_id = _community_id;
-        -- We allow setting the MUTED role even if you're not subscribed
-        if _role_id IS NOT NULL AND _role_id < 0 THEN
-            SELECT role_id INTO __role_id FROM hive_roles WHERE account_id = _account_id AND community_id = _community_id;
-            -- We don't allow setting a higher role than the current one if you aren't subscribed
-            IF __subscription_id IS NULL AND ((__role_id IS NOT NULL AND __role_id < _role_id ) OR __role_id IS NULL)  THEN
-                return false;
+        IF _role_id IS NOT NULL THEN
+            -- We allow setting the MUTED role even if you're not subscribed
+            IF _role_id > 0 THEN
+                SELECT role_id INTO __role_id FROM hive_roles WHERE account_id = _account_id AND community_id = _community_id;
+                -- We don't allow setting a higher role than the current one if you aren't subscribed
+                IF __subscription_id IS NULL AND ((__role_id IS NOT NULL AND __role_id < _role_id ) OR __role_id IS NULL)  THEN
+                    return false;
+                END IF;
             END IF;
         ELSE
             IF __subscription_id IS NULL THEN