diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-24 11:55:13 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-24 20:37:10 +0200 |
commit | 79f3abc0e200ffa772bc7722b5f384eb538d7576 (patch) | |
tree | f327110ebea5e65a1b5362cd2d55e2c001f8dbc0 /include | |
parent | a22652b76a5ed1fc130607e8999ed86681b4ed1f (diff) |
make oox::OptValue::value() assert if empty
as part of replacing OptValue with std::optional, we need to mimc the
behaviour of std::optional::value(), which will throw
bad_optional_access
Change-Id: Icf5141cefd4623a6a1bb7b3a3449d3af382e01c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136365
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/oox/helper/helper.hxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx index 9d5b7c3e2549..ef066f31d338 100644 --- a/include/oox/helper/helper.hxx +++ b/include/oox/helper/helper.hxx @@ -180,7 +180,7 @@ public: bool has_value() const { return mbHasValue; } bool operator!() const { return !mbHasValue; } - const Type& value() const { return maValue; } + const Type& value() const { assert(mbHasValue); return maValue; } const Type& value_or( const Type& rDefValue ) const { return mbHasValue ? maValue : rDefValue; } Type& operator*() { assert(mbHasValue); return maValue; } |