Do not dereference pointer if top object is NULL.