Don't crash when nIndex < 0

Change-Id: I24ba4365d9d5f78e875ea51382c6b1f864b2e5fe
(cherry picked from commit e225b0925b371bd33d40d97c240bd3165b628464)
Reviewed-on: https://gerrit.libreoffice.org/13631
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>