Fix crash issue when quickly exit the app

If the size of navigation history is 0, we do not need to get the first
history item.

BUG=XWALK-1863