[Libreoffice-commits] core.git: wizards/com

jan iversen jani at documentfoundation.org
Sat Jan 23 00:31:49 PST 2016


 wizards/com/sun/star/wizards/document/Control.java |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

New commits:
commit b996107585efb7bed88351d2cea2e56d8500c2fb
Author: jan iversen <jani at documentfoundation.org>
Date:   Thu Jan 21 19:35:26 2016 +0100

    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 at libreoffice.org>
    Reviewed-by: jan iversen <jani at documentfoundation.org>

diff --git a/wizards/com/sun/star/wizards/document/Control.java b/wizards/com/sun/star/wizards/document/Control.java
index 17d12f0..9ff4691 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());


More information about the Libreoffice-commits mailing list