title: Hyperledger Fabric: panic: runtime error: invalid memory address or nil pointer dereference at fabric/peer/common.NewPeerClientForAddress
body: <p>we are trying to invoke chaincode using following command:</p>
  
  <pre><code>FABRIC_CFG_PATH=${PWD} CORE_PEER_LOCALMSPID=org1MSP CORE_LOGGING_LEVEL=debug CORE_PEER_TLS_ENABLED=true CORE_PEER_TLS_CLIENTAUTHREQUIRED=true CORE_PEER_MSPCONFIGPATH=msp CORE_PEER_TLS_CLIENTCERT_FILE=user-org1-tls.pem CORE_PEER_TLS_CLIENTKEY_FILE=user-org1-tls.key peer chaincode invoke -C dscsa -n mycc -c '{"Args":["create","00000"]}' -o orderer1-ord:7050 --tls --cafile ord-ca-chain.pem --peerAddresses peer3-org1:7051 --tlsRootCertFiles org1-ca-chain.pem --peerAddresses peer3-org2:7051 --tlsRootCertFiles org2-ca-chain.pem --peerAddresses peer3-org3:7051 --tlsRootCertFiles org3-ca-chain.pem
  </code></pre>
  
  <p>but get this error:</p>
  
  <pre><code>2019-03-21 19:04:37.459 UTC [msp] Validate -&gt; DEBU 036 MSP org1MSP validating identity
  panic: runtime error: invalid memory address or nil pointer dereference
  [signal SIGSEGV: segmentation violation code=0x1 addr=0x60 pc=0x110fddc]
  
  goroutine 1 [running]:
  github.com/hyperledger/fabric/peer/common.NewPeerClientForAddress(0x7ffd955fe783, 0x9, 0x7ffd955fe7a0, 0x10, 0x8fb52c, 0x9e8745, 0x14848a7)
      /opt/gopath/src/github.com/hyperledger/fabric/peer/common/peerclient.go:44 +0x8c
  github.com/hyperledger/fabric/peer/common.GetEndorserClient(0x7ffd955fe783, 0x9, 0x7ffd955fe7a0, 0x10, 0x4, 0x1, 0xc4205d1988, 0x9e5bec)
      /opt/gopath/src/github.com/hyperledger/fabric/peer/common/peerclient.go:122 +0x56
  github.com/hyperledger/fabric/peer/chaincode.InitCmdFactory(0x1482fcf, 0x6, 0x101, 0x1a, 0x13b1dc0, 0xc420181f90)
      /opt/gopath/src/github.com/hyperledger/fabric/peer/chaincode/common.go:369 +0xb19
  github.com/hyperledger/fabric/peer/chaincode.chaincodeInvoke(0xc4200d9680, 0x0, 0x0, 0x0)
      /opt/gopath/src/github.com/hyperledger/fabric/peer/chaincode/invoke.go:53 +0xff
  github.com/hyperledger/fabric/peer/chaincode.invokeCmd.func1(0xc4200d9680, 0xc4202be600, 0x0, 0x17, 0x0, 0x0)
      /opt/gopath/src/github.com/hyperledger/fabric/peer/chaincode/invoke.go:26 +0x34
  github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).execute(0xc4200d9680, 0xc4202be480, 0x17, 0x18, 0xc4200d9680, 0xc4202be480)
      /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:698 +0x46d
  github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x1c90320, 0x1d78c30, 0xf, 0x1)
      /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:783 +0x2e4
  github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).Execute(0x1c90320, 0x1, 0xffffffffffffffff)
      /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:736 +0x2b
  main.main()
      /opt/gopath/src/github.com/hyperledger/fabric/peer/main.go:97 +0x5bf
  </code></pre>
  
  <p>we are using v1.3 of fabric. how can we fix this?</p>