Permalink
Browse files

make sure udp connection is not null before querying it.

  • Loading branch information...
1 parent 7bee4d3 commit 6b4b9f1d78a0df256fb7def36c1af3dbc0fa2f48 @willscott willscott committed Mar 30, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 oneswarm_f2f/src/edu/washington/cs/oneswarm/f2f/network/FriendConnection.java
View
4 oneswarm_f2f/src/edu/washington/cs/oneswarm/f2f/network/FriendConnection.java
@@ -744,7 +744,7 @@ public int getRemotePublicKeyHash() {
}
public int getSendQueueCurrentCapacity(int channelId) {
- if (udpConnection.isSendingActive()) {
+ if (udpConnection != null && udpConnection.isSendingActive()) {
return udpConnection.getCapacityForChannel(channelId);
} else {
return (FriendConnectionQueue.MAX_FRIEND_QUEUE_LENGTH - friendConnectionQueue
@@ -753,7 +753,7 @@ public int getSendQueueCurrentCapacity(int channelId) {
}
public int getSendQueuePotentialCapacity(int channelId) {
- if (udpConnection.isSendingActive()) {
+ if (udpConnection != null && udpConnection.isSendingActive()) {
return udpConnection.getPotentialCapacityForChannel(channelId);
} else {
return (FriendConnectionQueue.MAX_FRIEND_QUEUE_LENGTH) / this.overlayTransports.size();

0 comments on commit 6b4b9f1

Please sign in to comment.