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

Fix for NPE when the OpenSSLSocketImpl returns null from getNpnSelectedProtocol.

This commit is contained in:
Adam Speakman
2014-02-06 12:06:17 +13:00
parent 85fbb0abeb
commit 0ca4c82dd1

View File

@@ -293,7 +293,9 @@ public class Platform {
byte[] alpnResult = (byte[]) getAlpnSelectedProtocol.invoke(socket);
if (alpnResult != null) return ByteString.of(alpnResult);
}
return ByteString.of((byte[]) getNpnSelectedProtocol.invoke(socket));
byte[] npnResult = (byte[]) getNpnSelectedProtocol.invoke(socket);
if (npnResult == null) return null;
return ByteString.of(npnResult);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {