Make console more robust against bad input

Change-Id: I749f8650612560c1cdf6caab80f427173cf45be1
2 files changed