diff options
author | jan iversen <jani@documentfoundation.org> | 2016-01-21 19:35:26 +0100 |
---|---|---|
committer | jan iversen <jani@documentfoundation.org> | 2016-01-23 08:31:18 +0000 |
commit | b996107585efb7bed88351d2cea2e56d8500c2fb (patch) | |
tree | 3ab2449476bf292f8f7978fd6ac2e0923b8ffd1a /wizards/com | |
parent | ded9e554d470b5a2c7238f5b61effada08ecef39 (diff) |
cid#1326113, 1326410, 1326411
Removed reference to elements in a null pointer.
Change-Id: Ife6fc68128284e291130a9a81bb7557ce03197ed
Reviewed-on: https://gerrit.libreoffice.org/21690
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: jan iversen <jani@documentfoundation.org>
Diffstat (limited to 'wizards/com')
-rw-r--r-- | wizards/com/sun/star/wizards/document/Control.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/wizards/com/sun/star/wizards/document/Control.java b/wizards/com/sun/star/wizards/document/Control.java index 17d12f0a4b32..9ff4691d2760 100644 --- a/wizards/com/sun/star/wizards/document/Control.java +++ b/wizards/com/sun/star/wizards/document/Control.java @@ -75,7 +75,7 @@ public class Control extends Shape try { icontroltype = _icontroltype; - String sServiceName = oFormHandler.sModelServices[getControlType()]; + String sServiceName = oFormHandler.sModelServices[icontroltype]; Object oControlModel = oFormHandler.xMSFDoc.createInstance(sServiceName); xControlModel = UnoRuntime.queryInterface( XControlModel.class, oControlModel ); xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, oControlModel ); @@ -185,15 +185,21 @@ public class Control extends Shape else { Size aPeerSize = getPeerSize(); + int aWidth; + if (aPeerSize == null) + aWidth = 0; + else + aWidth = aPeerSize.Width; + // We increase the preferred Width a bit so that the control does not become too small // when we change the border from "3D" to "Flat" if (getControlType() == FormHandler.SOCHECKBOX) { - return aPeerSize.Width * oFormHandler.getXPixelFactor(); + return aWidth * oFormHandler.getXPixelFactor(); } else { - return (aPeerSize.Width * oFormHandler.getXPixelFactor()) + 200; + return (aWidth * oFormHandler.getXPixelFactor()) + 200; } } } @@ -208,6 +214,11 @@ public class Control extends Shape { Size aPeerSize = getPeerSize(); int nHeight = aPeerSize.Height; + if (aPeerSize == null) + nHeight = 0; + else + nHeight = aPeerSize.Height; + // We increase the preferred Height a bit so that the control does not become too small // when we change the border from "3D" to "Flat" return ((nHeight + 1) * oFormHandler.getYPixelFactor()); |