1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-11-23 01:06:17 +00:00

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

View File

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