Skip to content

Commit c1a3de6

Browse files
authored
Return empty list when original content is null (#1225)
When the list that can be obtained at the time of error is null, it becomes NPE. This change returns an empty list when null, to prevent unintended NPE. Resolve #1223
1 parent fe8b3f6 commit c1a3de6

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

clients/line-bot-insight-client/src/main/java/com/linecorp/bot/insight/client/InsightClientException.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public String getError() {
5050
}
5151

5252
public List<ErrorDetail> getDetails() {
53+
if (details == null) {
54+
return Collections.emptyList();
55+
}
5356
return Collections.unmodifiableList(details);
5457
}
5558
}

clients/line-bot-manage-audience-client/src/main/java/com/linecorp/bot/audience/client/ManageAudienceClientException.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public String getError() {
5050
}
5151

5252
public List<ErrorDetail> getDetails() {
53+
if (details == null) {
54+
return Collections.emptyList();
55+
}
5356
return Collections.unmodifiableList(details);
5457
}
5558
}

clients/line-bot-messaging-api-client/src/main/java/com/linecorp/bot/messaging/client/MessagingApiClientException.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,16 @@ public String getError() {
5757
}
5858

5959
public List<ErrorDetail> getDetails() {
60+
if (details == null) {
61+
return Collections.emptyList();
62+
}
6063
return Collections.unmodifiableList(details);
6164
}
6265

6366
public List<SentMessage> getSentMessages() {
67+
if (sentMessages == null) {
68+
return Collections.emptyList();
69+
}
6470
return Collections.unmodifiableList(sentMessages);
6571
}
6672
}

0 commit comments

Comments
 (0)