Fix error thrown when pressing down in repo too many times

Fixes a little annoying bug. When you have the REPL open and hit down when you've reached the end of your history, a lua error gets thrown:

![image](https://cloud.githubusercontent.com/assets/5489149/3491132/d37c4314-0586-11e4-9560-f3acada81ffb.png)