handle error

This commit is contained in:
Naoyuki Kanezawa
2013-04-28 23:42:35 +09:00
parent 5bc39e7aff
commit 85631df4c0

View File

@@ -38,7 +38,10 @@ public class Parser {
}
public static Packet decodePacket(String data) {
int type = Character.getNumericValue(data.charAt(0));
int type = -1;
try {
type = Character.getNumericValue(data.charAt(0));
} catch(IndexOutOfBoundsException e) {}
if (type < 0 || type >= packets.size()) {
return err;
}