Fixed bug occurring when painting the last record

An empty array exception was being thrown (off by one errors)