NCBC-195: NRE on view query with bad credentials

Change-Id: Ibf4d11be20301a1fc211782edf047237e84f6cfa
Reviewed-on: http://review.couchbase.org/23787
Reviewed-by: Saakshi Manocha <saakshi.manocha@globallogic.com>
Tested-by: Saakshi Manocha <saakshi.manocha@globallogic.com>