xmloff/source/script/xmlbasicscript.cxx | 3 +++ 1 file changed, 3 insertions(+)
New commits: commit 91a14169c007411e40b8c99e9b438aa362496622 Author: Stephan Bergmann <[email protected]> AuthorDate: Wed Oct 8 21:19:33 2025 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Mon Oct 13 15:30:03 2025 +0200 Failure to getBasicLibraries() is normal in --disable-scripting builds ...(like the Emscripten build), see the HAVE_FEATURE_SCRIPTING conditions in SfxObjectShell::GetBasicContainer (sfx2/source/doc/objxtor.cxx) and SfxApplication::GetBasicContainer (sfx2/source/appl/appbas.cxx), so in such builds loading e.g. xmloff/qa/unit/data/MCGR_threeStops.fodt containing > <office:scripts> > <office:script script:language="ooo:Basic"> > <ooo:libraries xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink"> > <ooo:library-embedded ooo:name="Standard"/> > </ooo:libraries> > </office:script> > </office:scripts> would fail with > warn:sax:392777:392777:sax/source/fastparser/fastparser.cxx:645: Unexpected exception from XML parser com.sun.star.xml.sax.SAXException message: "nowhere to import to at xmloff/source/script/xmlbasicscript.cxx:96" > wrapped: and a > General Error. > General input/output error. error box. But all the code paths using m_xLibContainer appear to first check it to be non-null, so it seems rather harmless to make a null m_xLibContainer non-fatal here for such builds at least. Change-Id: I6f20b15cb4032fc6293aaae6551095125360171e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192076 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <[email protected]> (cherry picked from commit 2f4f578bbf042a0a67d8407c82b57a8ad9db56b3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192087 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Michael Stahl <[email protected]> diff --git a/xmloff/source/script/xmlbasicscript.cxx b/xmloff/source/script/xmlbasicscript.cxx index dc99e90a7d39..4cbd80096216 100644 --- a/xmloff/source/script/xmlbasicscript.cxx +++ b/xmloff/source/script/xmlbasicscript.cxx @@ -20,6 +20,7 @@ #include <sal/config.h> #include "xmlbasicscript.hxx" +#include <config_features.h> #include <sal/log.hxx> #include <utility> #include <xmloff/xmlnamespace.hxx> @@ -91,10 +92,12 @@ BasicLibrariesElement::BasicLibrariesElement(SvXMLImport& rImport, SAL_WARN_IF(!m_xLibContainer.is(), "xmlscript.xmlflat", "BasicImport::startRootElement: nowhere to import to!"); +#if HAVE_FEATURE_SCRIPTING if (!m_xLibContainer.is()) { throw xml::sax::SAXException(u"nowhere to import to"_ustr, Reference<XInterface>(), Any()); } +#endif } // XElement
