Browse Source

Merge pull request #159 from ShaneMcC/master

Don't throw ArrayIndexOutOfBoundsException if we get given an entirely empty line
pull/160/head
Shane Mc Cormack 6 years ago
parent
commit
d27ad50028
No account linked to committer's email address
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      irc/src/main/java/com/dmdirc/parser/irc/IRCReader.java

+ 2
- 2
irc/src/main/java/com/dmdirc/parser/irc/IRCReader.java View File

@@ -273,7 +273,7 @@ public class IRCReader implements Closeable {
273 273
          */
274 274
         private String[] checkTSIRC(final String[] lineTokens) {
275 275
             String[] tokens = lineTokens;
276
-            if (!tokens[0].isEmpty() && tokens[0].charAt(0) == '@') {
276
+            if (tokens.length > 0 && !tokens[0].isEmpty() && tokens[0].charAt(0) == '@') {
277 277
                 final int tsEnd = tokens[0].indexOf('@', 1);
278 278
                 if (tsEnd > -1) {
279 279
                     try {
@@ -296,7 +296,7 @@ public class IRCReader implements Closeable {
296 296
          */
297 297
         private String[] checkMessageTags(final String[] lineTokens) {
298 298
             String[] tokens = lineTokens;
299
-            if (!tokens[0].isEmpty() && tokens[0].charAt(0) == '@') {
299
+            if (tokens.length > 0 && !tokens[0].isEmpty() && tokens[0].charAt(0) == '@') {
300 300
                 final String[] lineTags = tokens[0].substring(1).split(";");
301 301
                 for (final String keyVal : lineTags) {
302 302
                     if (!keyVal.isEmpty()) {

Loading…
Cancel
Save