Check the surface pointer before accessing it to get a handle