Info: Prevent crash in makecustomchallenge when user parameter is missing (#11296)
Some checks failed
Node.js CI / build (18.x) (push) Has been cancelled

This commit is contained in:
Dieter Reinert
2025-07-24 18:00:40 +02:00
committed by GitHub
parent 4cd2f90abf
commit e716ef1aba

View File

@@ -2862,12 +2862,15 @@ export const commands: Chat.ChatCommands = {
const args = Chat.parseArguments(target, ' | ', {
allowEmpty: true, useIDs: false,
});
if (!args.format?.[0]) {
return this.popupReply(`No format specified.`);
}
const format = Dex.formats.get(toID(args.format[0]));
if (format.effectType !== 'Format') {
return this.popupReply(`The format '${format}' does not exist.`);
}
delete args.format;
const targetUserID = toID(args.user[0]);
const targetUserID = toID(args.user?.[0] || '');
if (targetUserID) {
this.checkChat();
if (!Users.get(targetUserID)) {