fdo#77806: Check the boundaries before accessing an array....

Change-Id: I0878f734599f566cde83183947cd7613c0f8d5c6
(cherry picked from commit a45973a90625f4b9e0f603154194f357ff2418d4)
Reviewed-on: https://gerrit.libreoffice.org/9292
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
fdo#77379: Don't return from the call. Notes are handled at the end.

Returning prematurely would end up skipping pasting of notes.

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