Handle missing captcha parameter correctly

Fixes #644
This commit is contained in:
AsamK 2021-06-15 23:15:36 +02:00
parent a0f04a9bc1
commit ca3871e223

View file

@ -27,7 +27,8 @@ public class RegisterCommand implements RegistrationCommand {
@Override @Override
public void handleCommand(final Namespace ns, final RegistrationManager m) throws CommandException { public void handleCommand(final Namespace ns, final RegistrationManager m) throws CommandException {
final boolean voiceVerification = ns.getBoolean("voice"); final boolean voiceVerification = ns.getBoolean("voice");
final var captcha = ns.getString("captcha").replace("signalcaptcha://", ""); final var captchaString = ns.getString("captcha");
final var captcha = captchaString == null ? null : captchaString.replace("signalcaptcha://", "");
try { try {
m.register(voiceVerification, captcha); m.register(voiceVerification, captcha);