Check if the stack if empty before pulling from it. Prevent popping
element from empty stack.

Signed-off-by: Pengcheng Bian <pbian@actuate.com>
Remove final keyword for enhancement purpose.

Signed-off-by: Pengcheng Bian <pbian@actuate.com>
Merge pull request #44 from TerryPCBian/master

Check if the stack if empty before pulling from it.