check that stacks are not empty before top()

Change-Id: Iad5b3381b8201c5ac32a5bdf99bd3d5872ea3afc
coverity#708628 Uninitialized pointer field

Change-Id: I340eb9e7550083818874fed90d0a94e15fd597fd