Fix an exception when pressing up-arrow in a buffer without history