Apparently there can be TLDocuments without any TLDocumentAttributes. This interrupted the message download with an NPE. Fixes #10.

This commit is contained in:
Fabian Schlenz 2016-09-05 06:14:52 +02:00
parent 11b5dc66e5
commit 5a9cd6bd80
1 changed files with 2 additions and 2 deletions

View File

@ -60,7 +60,7 @@ public class DocumentFileManager extends AbstractMediaFileManager {
public boolean isSticker() {
TLDocumentAttributeSticker sticker = null;
for(TLAbsDocumentAttribute attr : doc.getAttributes()) {
if (doc.getAttributes() != null) for(TLAbsDocumentAttribute attr : doc.getAttributes()) {
if (attr instanceof TLDocumentAttributeSticker) {
sticker = (TLDocumentAttributeSticker)attr;
}
@ -78,7 +78,7 @@ public class DocumentFileManager extends AbstractMediaFileManager {
if (doc == null) return "empty";
String ext = null;
String original_filename = null;
for(TLAbsDocumentAttribute attr : doc.getAttributes()) {
if (doc.getAttributes() != null) for(TLAbsDocumentAttribute attr : doc.getAttributes()) {
if (attr instanceof TLDocumentAttributeFilename) {
original_filename = ((TLDocumentAttributeFilename)attr).getFileName();
}