Resolves: fdo#79392 don't access after last row, when last row is max last row

Change-Id: I06749af90bed6a43f3fb6b3b5ceb61d5fbbc7c02
(cherry picked from commit a35d92197d850527bd294eb6197b5bf83109d5be)