Added conn object null check.

Made sure the conn object was valid before trying to run queries,