first delete, then nullify

Otherwise an unreachable can happen.

Change-Id: I04f03fc97aa73eb0bf75ad71ca8a1cf2d3729c08
Reviewed-on: https://gerrit.libreoffice.org/10047
Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>