Browse Source

Update Document.java

Fix api change
master
Ruben Bermudez 11 years ago
parent
commit
23d380ff7f
  1. 5
      src/main/java/org/telegram/api/Document.java

5
src/main/java/org/telegram/api/Document.java

@ -34,7 +34,12 @@ public class Document {
public Document(JSONObject jsonObject) { public Document(JSONObject jsonObject) {
this.fileId = jsonObject.getString(FILEID_FIELD); this.fileId = jsonObject.getString(FILEID_FIELD);
if (jsonObject.has(THUMB_FIELD) {
this.thumb = new PhotoSize(jsonObject.getJSONObject(THUMB_FIELD)); this.thumb = new PhotoSize(jsonObject.getJSONObject(THUMB_FIELD));
}
else {
this.thumb = null;
}
this.fileName = jsonObject.optString(FILENAME_FIELD, ""); this.fileName = jsonObject.optString(FILENAME_FIELD, "");
this.mimeType = jsonObject.optString(MIMETYPE_FIELD, ""); this.mimeType = jsonObject.optString(MIMETYPE_FIELD, "");
this.fileSize = jsonObject.optInt(FILESIZE_FIELD, 0); this.fileSize = jsonObject.optInt(FILESIZE_FIELD, 0);

Loading…
Cancel
Save