summaryrefslogtreecommitdiff
path: root/oox/source/drawingml/table/tablestylelistfragmenthandler.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-06-23 14:45:26 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-06-24 10:40:19 +0200
commit08489c211a902398c5f49c4f4676184b1657694c (patch)
tree07a53549a45f49e5bbce39f50a9074ee0dde36ee /oox/source/drawingml/table/tablestylelistfragmenthandler.cxx
parent66365b89f6f335e62db690add57482e91418c7d2 (diff)
almost nobody is using the oox::AttributeList::get methods properly
Most of the call sites just ignore the fact that we are returning an optional value here. Which means that when an attribute is missing, they get an empty string or zero. And we seem to be fine with that. So make a plugin that warns about calling value() on a temporay OptValue. And add a utility method so we don't have to pay the cost of passing a default value to getString() The need for this is driven by wanting to change to std::optional, which will throw an exception if code attempts to read an empty std::optional Change-Id: Idb0a5ad1eac66b5caa93d6195928bad9e0b2ad70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136283 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox/source/drawingml/table/tablestylelistfragmenthandler.cxx')
-rw-r--r--oox/source/drawingml/table/tablestylelistfragmenthandler.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/oox/source/drawingml/table/tablestylelistfragmenthandler.cxx b/oox/source/drawingml/table/tablestylelistfragmenthandler.cxx
index 20ff3e0dc105..c41f937fd2ab 100644
--- a/oox/source/drawingml/table/tablestylelistfragmenthandler.cxx
+++ b/oox/source/drawingml/table/tablestylelistfragmenthandler.cxx
@@ -48,7 +48,7 @@ ContextHandlerRef TableStyleListFragmentHandler::onCreateContext(
switch( aElementToken )
{
case A_TOKEN( tblStyleLst ): // CT_TableStyleList
- mrTableStyleList.getDefaultStyleId() = rAttribs.getString( XML_def ).value();
+ mrTableStyleList.getDefaultStyleId() = rAttribs.getStringDefaulted( XML_def );
break;
case A_TOKEN( tblStyle ): // CT_TableStyle
std::vector< TableStyle >& rTableStyles = mrTableStyleList.getTableStyles();