bivashy / MC-Auth-with-Link

Fork of mc-auth. Added multiple ways to link
Eclipse Public License 2.0
36 stars 11 forks source link

NullPointerException and other "not enough arguments" handling issues while using Telegram bot #72

Closed arskvsh closed 1 year ago

arskvsh commented 1 year ago

MCAuth 1.7.12, TelegramBotApi 1.0.0, Velocity-3.2.0-SNAPSHOT-265

I refer to the commands with their config names as I have the slash commands renamed. Config attached: telegram-config.yml.txt

Using 'account-control' and 'unlink' (and may be some other?) commands without parameters in the Telegram bot causes NullPointerException in the server console (server doesn't crash though). Seems that it should be handled at least as 'change-pass' one, which neither throws any exceptions nor returning any messages in Telegram when used without parameters.

However, both behaviours seem strange as there are messages that are supposed to be shown in such cases, their translations can be seen in the config (changepass-not-enough-arguments, unlink-not-enough-arguments, etc.). I haven't succeeded getting those messages anyhow.

image

[01:22:53 ERROR]: java.lang.NullPointerException: Cannot invoke "com.bivashy.auth.api.account.Account.getName()" because "account" is null
[01:22:53 ERROR]:       at me.mastercapexd.auth.messenger.commands.AccountCommand.accountMenu(AccountCommand.java:18)

image

bivashy commented 1 year ago

Thank you for providing such a thorough issue report. This would be fixed in the next update.

Issue appears to lie within the command library, which interprets certain arguments as "null", resulting in the disregarding of certain messages.

bivashy commented 1 year ago

Fix seems to be working изображение