summaryrefslogtreecommitdiff
path: root/sc/source/core
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-08-23 13:47:40 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-08-28 09:43:40 +0200
commit68e797402692c5c8abf1b2c4374e12a8d2707d07 (patch)
treed10643f2ce00efe809de0e9548a2c38943e2d11f /sc/source/core
parent5733cdba90b099637805648b193510268def74be (diff)
new loplugin:optionalbool
which warns against using the 'operator bool' conversion of std::optional<bool> which can lead to interesting bugs The bugs that this plugin have been submitted independantly, so this change is just using has_value() in relevant places. Change-Id: I259b837feeecddcb8cd1d7e5db1e85bf505907cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155978 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/core')
-rw-r--r--sc/source/core/data/dptabsrc.cxx2
-rw-r--r--sc/source/core/data/patattr.cxx2
2 files changed, 2 insertions, 2 deletions
diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx
index c9438671570d..f589e1b538e8 100644
--- a/sc/source/core/data/dptabsrc.cxx
+++ b/sc/source/core/data/dptabsrc.cxx
@@ -88,7 +88,7 @@ SC_SIMPLE_SERVICE_INFO( ScDPMember, "ScDPMember", "com.sun.star.sheet.
static bool lcl_GetBoolFromAny( const uno::Any& aAny )
{
auto b = o3tl::tryAccess<bool>(aAny);
- return b && *b;
+ return b.has_value() && *b;
}
ScDPSource::ScDPSource( ScDPTableData* pD ) :
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index e2cd22a390c6..7638652e6857 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -1200,7 +1200,7 @@ ScPatternAttr* ScPatternAttr::PutInPool( ScDocument* pDestDoc, ScDocument* pSrcD
bool ScPatternAttr::IsVisible() const
{
- if (!mxVisible)
+ if (!mxVisible.has_value())
mxVisible = CalcVisible();
return *mxVisible;
}