1
0
mirror of https://github.com/square/okhttp.git synced 2026-01-27 04:22:07 +03:00

Merge pull request #157 from square/jwilson/no_interface

Don't explode if we can't find an interface for a local address.
This commit is contained in:
Jesse Wilson
2013-04-29 14:26:09 -07:00

View File

@@ -201,6 +201,9 @@ public class Platform {
try {
NetworkInterface networkInterface = NetworkInterface.getByInetAddress(
socket.getLocalAddress());
if (networkInterface == null) {
return super.getMtu(socket); // There's no longer an interface with this local address.
}
return (Integer) getMtu.invoke(networkInterface);
} catch (IllegalAccessException e) {
throw new AssertionError(e);