diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-03-12 14:12:59 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2020-03-16 18:26:57 +0100 |
commit | 5d8e07231b6e8b106292f212a3c80be004e11d6a (patch) | |
tree | d61aa5648384c40c63f4a9ad103646b469826e84 | |
parent | a22c6cdc74584ae6c9efd731ea524de210ec8c2c (diff) |
Some more checks for correct screen size
Change-Id: Id5a811e4227052fd9117ab2b099de31e8e3b90c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90413
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
(cherry picked from commit 3741d70743c297029f54b20b0ca711f40cff7097)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90576
Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r-- | vcl/source/app/svapp.cxx | 11 | ||||
-rw-r--r-- | vcl/win/app/salinfo.cxx | 10 |
2 files changed, 19 insertions, 2 deletions
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 33420e5456fc..5a02e96b05a5 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1229,7 +1229,16 @@ unsigned int Application::GetDisplayExternalScreen() tools::Rectangle Application::GetScreenPosSizePixel( unsigned int nScreen ) { SalSystem* pSys = ImplGetSalSystem(); - return pSys ? pSys->GetDisplayScreenPosSizePixel( nScreen ) : tools::Rectangle(); + if (!pSys) + { + SAL_WARN("vcl", "Requesting screen size/pos for screen #" << nScreen << " failed"); + assert(false); + return tools::Rectangle(); + } + tools::Rectangle aRect = pSys->GetDisplayScreenPosSizePixel(nScreen); + if (aRect.getHeight() == 0) + SAL_WARN("vcl", "Requesting screen size/pos for screen #" << nScreen << " returned 0 height."); + return aRect; } namespace { diff --git a/vcl/win/app/salinfo.cxx b/vcl/win/app/salinfo.cxx index 90fa81b04d0e..ba914e280e82 100644 --- a/vcl/win/app/salinfo.cxx +++ b/vcl/win/app/salinfo.cxx @@ -21,6 +21,7 @@ #include <rtl/ustrbuf.hxx> #include <o3tl/char16_t2wchar_t.hxx> +#include <sal/log.hxx> #include <vcl/window.hxx> #include <win/salsys.h> @@ -161,7 +162,14 @@ unsigned int WinSalSystem::GetDisplayBuiltInScreen() tools::Rectangle WinSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen ) { initMonitors(); - return (nScreen < m_aMonitors.size()) ? m_aMonitors[nScreen].m_aArea : tools::Rectangle(); + if (nScreen >= m_aMonitors.size()) + { + SAL_WARN("vcl", "Requested screen size/pos for screen #" + << nScreen << ", but only " << m_aMonitors.size() << " screens found."); + assert(false); + return tools::Rectangle(); + } + return m_aMonitors[nScreen].m_aArea; } int WinSalSystem::ShowNativeMessageBox(const OUString& rTitle, const OUString& rMessage) |