* PeerManager: Fix NPE on Android (ticket #687)

This commit is contained in:
zzz
2012-08-12 11:19:49 +00:00
parent a76f840ff8
commit e67dd15308
3 changed files with 20 additions and 4 deletions

View File

@ -125,6 +125,8 @@ public abstract class BasePRNGStandalone implements IRandomStandalone {
throw new ArrayIndexOutOfBoundsException("offset=" + offset + " length="
+ length + " limit=" + out.length);
if (buffer == null)
throw new IllegalStateException("Random is shut down - do you have a static ref?");
if (ndx >= buffer.length) {
fillBlock();
ndx = 0;
@ -162,6 +164,8 @@ public abstract class BasePRNGStandalone implements IRandomStandalone {
}
private byte nextByteInternal() {//throws LimitReachedException {
if (buffer == null)
throw new IllegalStateException("Random is shut down - do you have a static ref?");
if (ndx >= buffer.length) {
this.fillBlock();
ndx = 0;