1
0
Эх сурвалжийг харах

cmd_roles: Add some sanity

Bryan Drewery 12 жил өмнө
parent
commit
6f2a22ceb4

+ 10 - 0
src/mod/irc.mod/cmdsirc.c

@@ -1434,6 +1434,16 @@ static void cmd_roles(int idx, char *par)
 
   putlog(LOG_CMDS, "*", "#%s# (%s) roles", dcc[idx].nick, chan->dname);
 
+  if (!channel_active(chan)) {
+    dprintf(idx, "I'm not on %s right now!\n", chan->dname);
+    return;
+  }
+
+  if (chan->bot_roles->size() == 0) {
+    dprintf(idx, "Roles for %s are not yet calculated.\n", chan->dname);
+    return;
+  }
+
   dprintf(idx, "Roles for %s:\n", chan->dname);
 
   /* Advertise roles */