diff options
author | Tarcísio Ladeia de Oliveira <wyrquill@gmail.com> | 2022-11-26 16:55:27 -0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-12-08 09:51:30 +0000 |
commit | 8f6dd15dce1e6116947b512c89d802fccc0bd6f1 (patch) | |
tree | b3832b4f5be2021062781ccb9efde215630dadc0 /vcl/source/image/ImplImageTree.cxx | |
parent | 9ee57f36e26373ee7144d076c93c3462c4fc7110 (diff) |
vcl: check for null device
The xmloff/draw test series was crashing soon after "testTextBoxLoss"
finished. Even though it finished successfully, CppUnitTest was crashing
when popping the protector. From the backtrace, the crash resulted from
attempts to access null pointers.
I do not know what caused those pointers to be null, but I added the
checks so that it could at least proceed to the other tests.
Change-Id: Ia0014a273142442a791a43fb9e3f75c2452bbd45
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143332
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/image/ImplImageTree.cxx')
-rw-r--r-- | vcl/source/image/ImplImageTree.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/vcl/source/image/ImplImageTree.cxx b/vcl/source/image/ImplImageTree.cxx index 549d0739139b..bdd4fcedfda5 100644 --- a/vcl/source/image/ImplImageTree.cxx +++ b/vcl/source/image/ImplImageTree.cxx @@ -75,8 +75,9 @@ bool ImageRequestParameters::convertToDarkTheme() sal_Int32 ImageRequestParameters::scalePercentage() { sal_Int32 aScalePercentage = 100; - if (!(meFlags & ImageLoadFlags::IgnoreScalingFactor)) - aScalePercentage = Application::GetDefaultDevice()->GetDPIScalePercentage(); + OutputDevice* pDevice = Application::GetDefaultDevice(); + if (!(meFlags & ImageLoadFlags::IgnoreScalingFactor) && pDevice != nullptr) + aScalePercentage = pDevice->GetDPIScalePercentage(); else if (mnScalePercentage > 0) aScalePercentage = mnScalePercentage; return aScalePercentage; |