Skip to content

Commit 726ef9d

Browse files
authored
Fix ModalMapping::getAsAttachmentList if no attachments were submitted (#2941)
1 parent fc4d1ef commit 726ef9d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/java/net/dv8tion/jda/api/interactions/modals/ModalMapping.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import net.dv8tion.jda.internal.utils.Helpers;
3030

3131
import javax.annotation.Nonnull;
32+
import java.util.Collections;
3233
import java.util.List;
3334
import java.util.Objects;
3435

@@ -203,6 +204,9 @@ public List<Message.Attachment> getAsAttachmentList()
203204
if (type != Component.Type.FILE_UPLOAD)
204205
typeError("List<Message.Attachment>");
205206

207+
if (resolved.isNull("attachments"))
208+
return Collections.emptyList();
209+
206210
final DataObject attachments = resolved.getObject("attachments");
207211
final EntityBuilder entityBuilder = interaction.getJDA().getEntityBuilder();
208212
return value.getArray("values")

0 commit comments

Comments
 (0)