643dd3
diff -up ./src/tunnel.cc.orig ./src/tunnel.cc
643dd3
--- ./src/tunnel.cc.orig	2016-07-01 13:37:50.000000000 +0200
643dd3
+++ ./src/tunnel.cc	2016-07-15 16:25:07.132823875 +0200
643dd3
@@ -475,7 +475,9 @@ TunnelStateData::handleConnectResponse(c
643dd3
     *status_ptr = rep.sline.status();
643dd3
 
643dd3
     // we need to relay the 401/407 responses when login=PASS(THRU)
643dd3
-    const char *pwd = server.conn->getPeer()->login;
643dd3
+    CachePeer *peer = server.conn->getPeer();
643dd3
+    const char *pwd = (peer) ? peer->login : NULL;
643dd3
+
643dd3
     const bool relay = pwd && (strcmp(pwd, "PASS") != 0 || strcmp(pwd, "PASSTHRU") != 0) &&
643dd3
                        (*status_ptr == Http::scProxyAuthenticationRequired ||
643dd3
                         *status_ptr == Http::scUnauthorized);