catch a few NPE when parsing invalid pep nodes

This commit is contained in:
Daniel Gultsch 2016-02-02 11:21:07 +01:00
parent ae83efe4a6
commit f30df7a535
1 changed files with 3 additions and 3 deletions

View File

@ -142,7 +142,7 @@ public class IqParser extends AbstractParser implements OnIqPacketReceived {
}
try {
publicKey = Curve.decodePoint(Base64.decode(signedPreKeyPublic.getContent(),Base64.DEFAULT), 0);
} catch (InvalidKeyException | IllegalArgumentException e) {
} catch (InvalidKeyException | IllegalArgumentException | NullPointerException e) {
Log.e(Config.LOGTAG, AxolotlService.LOGPREFIX+" : "+"Invalid signedPreKeyPublic in PEP: " + e.getMessage());
}
return publicKey;
@ -169,7 +169,7 @@ public class IqParser extends AbstractParser implements OnIqPacketReceived {
}
try {
identityKey = new IdentityKey(Base64.decode(identityKeyElement.getContent(), Base64.DEFAULT), 0);
} catch (InvalidKeyException | IllegalArgumentException e) {
} catch (InvalidKeyException | IllegalArgumentException | NullPointerException e) {
Log.e(Config.LOGTAG,AxolotlService.LOGPREFIX+" : "+"Invalid identityKey in PEP: "+e.getMessage());
}
return identityKey;
@ -200,7 +200,7 @@ public class IqParser extends AbstractParser implements OnIqPacketReceived {
try {
ECPublicKey preKeyPublic = Curve.decodePoint(Base64.decode(preKeyPublicElement.getContent(), Base64.DEFAULT), 0);
preKeyRecords.put(preKeyId, preKeyPublic);
} catch (InvalidKeyException | IllegalArgumentException e) {
} catch (InvalidKeyException | IllegalArgumentException | NullPointerException e) {
Log.e(Config.LOGTAG, AxolotlService.LOGPREFIX+" : "+"Invalid preKeyPublic (ID="+preKeyId+") in PEP: "+ e.getMessage()+", skipping...");
continue;
}