You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by jo...@apache.org on 2021/09/14 17:58:05 UTC

[mina] 05/05: applies null check

This is an automated email from the ASF dual-hosted git repository.

johnnyv pushed a commit to branch 2.2.X
in repository https://gitbox.apache.org/repos/asf/mina.git

commit 667517901d27ff9f342917bf1966aba150a427af
Author: Jonathan Valliere <jo...@apache.org>
AuthorDate: Tue Sep 14 13:57:24 2021 -0400

    applies null check
---
 .../org/apache/mina/proxy/handlers/socks/Socks4LogicHandler.java     | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/mina-core/src/main/java/org/apache/mina/proxy/handlers/socks/Socks4LogicHandler.java b/mina-core/src/main/java/org/apache/mina/proxy/handlers/socks/Socks4LogicHandler.java
index bb1354b..a03bf53 100644
--- a/mina-core/src/main/java/org/apache/mina/proxy/handlers/socks/Socks4LogicHandler.java
+++ b/mina-core/src/main/java/org/apache/mina/proxy/handlers/socks/Socks4LogicHandler.java
@@ -72,9 +72,8 @@ public class Socks4LogicHandler extends AbstractSocksLogicHandler {
     protected void writeRequest(final NextFilter nextFilter, final SocksProxyRequest request) {
         try {
             boolean isV4ARequest = Arrays.equals(request.getIpAddress(), SocksProxyConstants.FAKE_IP);
-            byte[] userID = request.getUserName().getBytes("ASCII");
-            byte[] host = isV4ARequest ? request.getHost().getBytes("ASCII") : null;
-
+            byte[] userID = request.getUserName() != null ? request.getUserName().getBytes("ASCII") : null;
+            byte[] host = request.getHost() != null ? request.getHost().getBytes("ASCII") : null;           
             int len = 9 + userID.length;
 
             if (isV4ARequest) {