Hey there! Before you report a bug or suggest a new feature,
please make sure to follow these steps first!
This is not the place to learn Java. Please refer to StackOverflow
for your general programming questions.
For questions join the official JDA discord server: https://discord.gg/0hMr4ce0tIl3SLv5
Sending a Webhook message without an embed throws an NPE.
Stacktrace:
java.lang.NullPointerException: null
at net.dv8tion.jda.webhook.WebhookMessage.getBody(WebhookMessage.java:136)
at net.dv8tion.jda.webhook.WebhookClient.send(WebhookClient.java:130)
at net.dv8tion.jda.webhook.WebhookClient.send(WebhookClient.java:241)
at fredboat.event.EventLogger.drainMessageQueue(EventLogger.java:266)
Here are some relevant points:
A nullable embed gets put into a list: https://github.com/DV8FromTheWorld/JDA/blob/38e5aa9bfe193e0b94f92553a28f419f3b264277/src/main/java/net/dv8tion/jda/core/entities/impl/DataMessage.java#L77
Building a webhook message from a message fetches all embeds of the message:
https://github.com/DV8FromTheWorld/JDA/blob/38e5aa9bfe193e0b94f92553a28f419f3b264277/src/main/java/net/dv8tion/jda/webhook/WebhookMessage.java#L112
This line then causes the NPE:
https://github.com/DV8FromTheWorld/JDA/blob/38e5aa9bfe193e0b94f92553a28f419f3b264277/src/main/java/net/dv8tion/jda/webhook/WebhookMessage.java#L136
Not sure where you want to fix this in your message stack, I'd have made a PR otherwise.
This has been fixed on the latest development build and will be in the next release. Thank you for reporting!
Let this is a benchmark for how all bug reports should be.
Very clean and helpful report @napstr.
While i do understand that some people do not have the technical know-how to look at lib sources and trace down the exact thing that happens, a stacktrace like here, with a bit of explanation what triggers the error (sending webhook message without embed) is all we need for bug reports
Most helpful comment
Let this is a benchmark for how all bug reports should be.
Very clean and helpful report @napstr.