Check the pointers before accessing them