proxy: Fix a potential panic handling error states.

Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Merge pull request #8877 from erikh/proxy_error_check

proxy: Fix a potential panic handling error states.