switch/case can't deal with null pointers

This commit is contained in:
Daniel Gultsch 2015-07-23 14:02:25 +02:00
parent cd204d5931
commit c32162c280
1 changed files with 3 additions and 0 deletions

View File

@ -39,6 +39,9 @@ public class IqPacket extends AbstractStanza {
public TYPE getType() { public TYPE getType() {
final String type = getAttribute("type"); final String type = getAttribute("type");
if (type == null) {
return TYPE.INVALID;
}
switch (type) { switch (type) {
case "error": case "error":
return TYPE.ERROR; return TYPE.ERROR;