fix crash when invalid tab index on iOS