mirror of https://github.com/zlatinb/muwire
prevent NPE in toString
parent
4a9e6d3b6b
commit
3f9ee887d6
|
@ -77,13 +77,15 @@ public class InfoHash {
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String rv = "InfoHash[root:"+Base32.encode(root) + " hashList:";
|
String rv = "InfoHash[root:"+Base32.encode(root) + " hashList:";
|
||||||
List<String> b32HashList = new ArrayList<>(hashList.length / SIZE);
|
List<String> b64HashList = new ArrayList<>();
|
||||||
byte [] tmp = new byte[SIZE];
|
if (hashList != null) {
|
||||||
for (int i = 0; i < hashList.length / SIZE; i++) {
|
byte [] tmp = new byte[SIZE];
|
||||||
System.arraycopy(hashList, SIZE * i, tmp, 0, SIZE);
|
for (int i = 0; i < hashList.length / SIZE; i++) {
|
||||||
b32HashList.add(Base32.encode(tmp));
|
System.arraycopy(hashList, SIZE * i, tmp, 0, SIZE);
|
||||||
|
b64HashList.add(Base32.encode(tmp));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rv += b32HashList.toString();
|
rv += b64HashList.toString();
|
||||||
rv += "]";
|
rv += "]";
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue