Skip to content

Commit

Permalink
fix: don't attempt to read empty string when parsing CM response
Browse files Browse the repository at this point in the history
  • Loading branch information
sietseringers committed Aug 10, 2021
1 parent 9775586 commit bc816f1
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ protected void sendMessage(String phone, String message) throws IOException {

InputStream responseBody = connection.getInputStream();
String text;
try (Scanner scanner = new Scanner(responseBody, StandardCharsets.UTF_8.name())) {
text = scanner.useDelimiter("\\A").next();
try (Scanner scanner = new Scanner(responseBody, StandardCharsets.UTF_8.name()).useDelimiter("\\A")) {
text = scanner.hasNext() ? scanner.next() : "";
}

// CM returns empty string when the SMS is successfully sent
Expand Down

0 comments on commit bc816f1

Please sign in to comment.