Console: Fix UPnP NPE on /peers (ticket #1830)

This commit is contained in:
zzz
2016-08-09 17:27:54 +00:00
parent 9c0ae14609
commit 0d5cf46625
3 changed files with 16 additions and 4 deletions

View File

@ -1,3 +1,6 @@
2016-08-09 zzz
* Console: Fix UPnP NPE on /peers (ticket #1830)
2016-08-02 zzz
* i2psnark: Fix SIOOBE on bad announce URL (ticket #1823)
* SSU: Fix peer test stuck when IPv6-only (ticket #1819)

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 8;
public final static long BUILD = 9;
/** for example "-test" */
public final static String EXTRA = "";

View File

@ -420,7 +420,10 @@ class UPnP extends ControlPoint implements DeviceChangeListener, EventListener {
if(getIP == null || !getIP.postControlAction())
return null;
String rv = (getIP.getOutputArgumentList().getArgument("NewExternalIPAddress")).getValue();
Argument a = getIP.getOutputArgumentList().getArgument("NewExternalIPAddress");
if (a == null)
return null;
String rv = a.getValue();
// I2P some devices return 0.0.0.0 when not connected
if ("0.0.0.0".equals(rv) || rv == null || rv.length() <= 0)
return null;
@ -442,8 +445,11 @@ class UPnP extends ControlPoint implements DeviceChangeListener, EventListener {
if(getIP == null || !getIP.postControlAction())
return -1;
Argument a = getIP.getOutputArgumentList().getArgument("NewUpstreamMaxBitRate");
if (a == null)
return -1;
try {
return Integer.parseInt(getIP.getOutputArgumentList().getArgument("NewUpstreamMaxBitRate").getValue());
return Integer.parseInt(a.getValue());
} catch (NumberFormatException nfe) {
return -1;
}
@ -464,8 +470,11 @@ class UPnP extends ControlPoint implements DeviceChangeListener, EventListener {
if(getIP == null || !getIP.postControlAction())
return -1;
Argument a = getIP.getOutputArgumentList().getArgument("NewDownstreamMaxBitRate");
if (a == null)
return -1;
try {
return Integer.parseInt(getIP.getOutputArgumentList().getArgument("NewDownstreamMaxBitRate").getValue());
return Integer.parseInt(a.getValue());
} catch (NumberFormatException nfe) {
return -1;
}