fdo#76361 : LO crash: LO crashes while saving the document to docx

The document contains an empty table with borders.
LO was treating this table as a nested table, which lead to
a TC tag mismatch.
In docxattributeoutput.cxx, inside 'switchHeaderFooter'
added a check against 'm_oldTableReference->m_pOldTablepInner'
For some documents, even if the above value was null, still
it was getting assigned to 'm_tableReference' . Thus in such situations
it leads to a crash.

Change-Id: I883267585cb804f961989797de57c4b843b96821
Reviewed-on: https://gerrit.libreoffice.org/8677
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>