Incorrect TelegramLongPollingCommandBot class constructor implementation causing NPE in CommandRegistry.removeUsernameFromCommandIfNeeded(String command) method.
See the code line:
|
this.commandRegistry = new CommandRegistry(allowCommandsWithUsername, this.getBotUsername()); |
In time the TelegramLongPollingCommandBot contructor creates the instance method this.getBotUsername() returns null because all fields of implementing class have not been initialized yet. Fields initialization runs after super.TelegramLongPollingCommandBot invocation
Suggested fix: add String botUsername parameter in TelegramLongPollingCommandBot constructor passing to CommandRegistry instance.
Incorrect TelegramLongPollingCommandBot class constructor implementation causing NPE in CommandRegistry.removeUsernameFromCommandIfNeeded(String command) method.
See the code line:
TelegramBots/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/TelegramLongPollingCommandBot.java
Line 56 in 1a2e7c9
In time the TelegramLongPollingCommandBot contructor creates the instance method this.getBotUsername() returns null because all fields of implementing class have not been initialized yet. Fields initialization runs after super.TelegramLongPollingCommandBot invocation
Suggested fix: add String botUsername parameter in TelegramLongPollingCommandBot constructor passing to CommandRegistry instance.