Skip to content

Commit

Permalink
Fix potentially dangerous issue
Browse files Browse the repository at this point in the history
  • Loading branch information
SunburntRock89 committed May 22, 2023
1 parent ef7e8a5 commit f74fa54
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/commands/standard/rcall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@ export default class RCall extends Command {
// Number is in a call, try again
if (number?.outgoingCalls.length > 0 || number.incomingCalls.length > 0) continue;

const channel = await this.client.getChannel(number.channelID);
if (!channel) {
this.client.deleteNumber(number.number);
try {
const channel = await this.client.getChannel(number.channelID);
if (!channel) {
this.client.deleteNumber(number.number);
continue;
}
} catch {
// Don't delete if there's potential for an unavailable guild to delete a number
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/internals/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class DTelClient extends Client<true> {
// Not safe to cache this as we won't get its updates
return this.channels.fetch(id, {
cache: false,
}).catch(() => null);
});
}

async getPerms(userID: string): Promise<Omit<PermissionLevel, "serverAdmin">> {
Expand Down

0 comments on commit f74fa54

Please sign in to comment.