Skip to content

Commit 0288b95

Browse files
authored
Fix uniqueId reading error if blank line is exists
1 parent a634aa1 commit 0288b95

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/com/annimon/similarimagesbot/BaseBotHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ private int geNextUpdateId(List<Update> updates, int previousUpdateId) {
9797

9898
private int readLastUpdateId() {
9999
try {
100-
return Integer.parseInt(Files.readString(uniqueIdPath));
100+
final String content = Files.readString(uniqueIdPath);
101+
return Integer.parseInt(content.trim());
101102
} catch (IOException ioe) {
102103
LOGGER.error("readLastUpdateId", ioe);
103104
return 0;

0 commit comments

Comments
 (0)