Procházet zdrojové kódy

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 před 6 roky
rodič
revize
d27ad50028
Žádný účet není propojen s e-mailovou adresou tvůrce revize

+ 2
- 2
irc/src/main/java/com/dmdirc/parser/irc/IRCReader.java Zobrazit soubor

@@ -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()) {

Načítá se…
Zrušit
Uložit