summaryrefslogtreecommitdiff
path: root/vcl/source/graphic
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-03-09 08:36:45 +0000
committerCaolán McNamara <caolanm@redhat.com>2023-03-09 11:50:42 +0000
commit33153adfc26e256e3cba27ae8de0ddbbd9f7ce78 (patch)
treea71cee36d43e305dde5912b597810ee4ce21a1e9 /vcl/source/graphic
parent013fbfb592f71c1f0a60b6a7ec08aded375515ac (diff)
ofz#56819 Null-dereference
since: commit d062f097cc48bd53247b7fb0c677d90fcc430ab7 Date: Wed Mar 8 02:14:11 2023 +0300 Simplify usage of BinaryDataContainer It is always used to store data read from streams Change-Id: I33d237a801b1cdf47b85b3fd3522c398ba08068b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148524 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source/graphic')
-rw-r--r--vcl/source/graphic/BinaryDataContainer.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/vcl/source/graphic/BinaryDataContainer.cxx b/vcl/source/graphic/BinaryDataContainer.cxx
index af6e5968911c..80e059137e63 100644
--- a/vcl/source/graphic/BinaryDataContainer.cxx
+++ b/vcl/source/graphic/BinaryDataContainer.cxx
@@ -21,9 +21,12 @@ BinaryDataContainer::BinaryDataContainer(SvStream& stream, size_t size)
size_t BinaryDataContainer::calculateHash() const
{
size_t nSeed = 0;
- o3tl::hash_combine(nSeed, getSize());
- for (sal_uInt8 const& rByte : *mpData)
- o3tl::hash_combine(nSeed, rByte);
+ if (mpData)
+ {
+ o3tl::hash_combine(nSeed, getSize());
+ for (sal_uInt8 const& rByte : *mpData)
+ o3tl::hash_combine(nSeed, rByte);
+ }
return nSeed;
}