summaryrefslogtreecommitdiffstats
path: root/include/xmloff/xmlictxt.hxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-12-20 14:34:56 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-12-20 19:26:18 +0100
commit813118bfbb453f812be9e1a30f84908b4e0bfb51 (patch)
tree7b032fc73b76a148ba98d85625596717e6f59d7d /include/xmloff/xmlictxt.hxx
parentloplugin:duplicate-defines (diff)
downloadcore-813118bfbb453f812be9e1a30f84908b4e0bfb51.tar.gz
core-813118bfbb453f812be9e1a30f84908b4e0bfb51.zip
add checks to optional fields in SvXMLImportContext
so when I convert ImportContext to FastParser APIs I don't accidentally rely on data that is not there Change-Id: If4700c7902e11f98a57542943f6a198822689df8 Reviewed-on: https://gerrit.libreoffice.org/85622 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/xmloff/xmlictxt.hxx')
-rw-r--r--include/xmloff/xmlictxt.hxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/xmloff/xmlictxt.hxx b/include/xmloff/xmlictxt.hxx
index 8dc67dac0227..5ab75bce286e 100644
--- a/include/xmloff/xmlictxt.hxx
+++ b/include/xmloff/xmlictxt.hxx
@@ -51,6 +51,7 @@ class XMLOFF_DLLPUBLIC SvXMLImportContext : public css::xml::sax::XFastContextHa
SvXMLImport& mrImport;
sal_uInt16 mnPrefix;
OUString maLocalName;
+ bool mbPrefixAndLocalNameFilledIn;
std::unique_ptr<SvXMLNamespaceMap> m_pRewindMap;
SAL_DLLPRIVATE std::unique_ptr<SvXMLNamespaceMap> TakeRewindMap() { return std::move(m_pRewindMap); }
@@ -63,8 +64,9 @@ protected:
public:
- sal_uInt16 GetPrefix() const { return mnPrefix; }
- const OUString& GetLocalName() const { return maLocalName; }
+ bool IsPrefixFilledIn() const { return mnPrefix != 0; }
+ sal_uInt16 GetPrefix() const { assert(mbPrefixAndLocalNameFilledIn && "those fields not filled, probably fast-parser context"); return mnPrefix; }
+ const OUString& GetLocalName() const { assert(mbPrefixAndLocalNameFilledIn && "those fields not filled, probably fast-parser context"); return maLocalName; }
/** A contexts constructor does anything that is required if an element
* starts. Namespace processing has been done already.