Adding a NULL check when retrieving the column count for the result reponse