Skip to content

Commit 7abba07

Browse files
committed
Return empty list to UpdatesListener if updates() is null, #234
1 parent d0273c6 commit 7abba07

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

library/src/main/java/com/pengrad/telegrambot/impl/UpdatesHandler.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.pengrad.telegrambot.response.GetUpdatesResponse;
77

88
import java.io.IOException;
9+
import java.util.Collections;
910
import java.util.List;
1011
import java.util.logging.Level;
1112
import java.util.logging.Logger;
@@ -68,6 +69,7 @@ public void onResponse(GetUpdates request, GetUpdatesResponse response) {
6869
}
6970

7071
List<Update> updates = response.updates();
72+
if (updates == null) updates = Collections.emptyList();
7173
int lastConfirmedUpdate = listener.process(updates);
7274

7375
if (lastConfirmedUpdate != CONFIRMED_UPDATES_NONE) {

0 commit comments

Comments
 (0)