Return empty set on invalid PEP devicelist
This commit is contained in:
parent
25450bf6d3
commit
6867b5c3ab
|
@ -1,5 +1,6 @@
|
||||||
package eu.siacs.conversations.crypto.axolotl;
|
package eu.siacs.conversations.crypto.axolotl;
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
@ -638,7 +639,7 @@ public class AxolotlService {
|
||||||
return ownDeviceId;
|
return ownDeviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerDevices(final Jid jid, final Set<Integer> deviceIds) {
|
public void registerDevices(final Jid jid, @NonNull final Set<Integer> deviceIds) {
|
||||||
for(Integer i:deviceIds) {
|
for(Integer i:deviceIds) {
|
||||||
Log.d(Config.LOGTAG, "Adding Device ID:"+ jid + ":"+i);
|
Log.d(Config.LOGTAG, "Adding Device ID:"+ jid + ":"+i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.siacs.conversations.parser;
|
package eu.siacs.conversations.parser;
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
@ -96,17 +97,14 @@ public class IqParser extends AbstractParser implements OnIqPacketReceived {
|
||||||
return items.findChild("item");
|
return items.findChild("item");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
public Set<Integer> deviceIds(final Element item) {
|
public Set<Integer> deviceIds(final Element item) {
|
||||||
Set<Integer> deviceIds = new HashSet<>();
|
Set<Integer> deviceIds = new HashSet<>();
|
||||||
if (item == null) {
|
if (item != null) {
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final Element list = item.findChild("list");
|
final Element list = item.findChild("list");
|
||||||
if(list == null) {
|
if (list != null) {
|
||||||
return null;
|
for (Element device : list.getChildren()) {
|
||||||
}
|
if (!device.getName().equals("device")) {
|
||||||
for(Element device : list.getChildren()) {
|
|
||||||
if(!device.getName().equals("device")) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -118,6 +116,8 @@ public class IqParser extends AbstractParser implements OnIqPacketReceived {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return deviceIds;
|
return deviceIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue