From 384a51342d4d5b0b559d62b1d3fbe6a1c71e96bf Mon Sep 17 00:00:00 2001 From: Ahab Hyde Date: Mon, 23 Apr 2018 14:32:21 +0200 Subject: [PATCH] Fix null come cognome --- src/com/em/miguelbridge/bottelegram/TGBot.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/com/em/miguelbridge/bottelegram/TGBot.java b/src/com/em/miguelbridge/bottelegram/TGBot.java index 0df7859..c093fcc 100644 --- a/src/com/em/miguelbridge/bottelegram/TGBot.java +++ b/src/com/em/miguelbridge/bottelegram/TGBot.java @@ -70,9 +70,15 @@ public class TGBot extends TelegramLongPollingBot { else if (update.hasMessage() && update.getMessage().hasPhoto()) { String chat_id = "" + update.getMessage().getChatId(); - String sender = update.getMessage().getFrom().getFirstName() + " " - + update.getMessage().getFrom().getLastName(); + String sender; String destination; + + if (update.getMessage().getFrom().getLastName() != null) + sender = update.getMessage().getFrom().getFirstName() + " " + + update.getMessage().getFrom().getLastName(); + else + sender = update.getMessage().getFrom().getFirstName(); + java.io.File downloadedFile = null; //TODO Scarica la foto