Fix core if dbperror is called without a connection active

dbperror can be called with dbproc NULL or dbproc->tds_socket NULL so
check to avoid crashes.
This can happen for instance if dblib is called to convert some data.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>