Fix crash when attempting to get command from empty history.