qadevOOo/tests/java/ifc/view/_XMultiSelectionSupplier.java |   56 +++++++------
 1 file changed, 34 insertions(+), 22 deletions(-)

New commits:
commit 28f9791b9649f700971624700aa0ecc25b2eae79
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Aug 22 10:07:48 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Aug 22 15:07:15 2022 +0200

    cid#1509396 Explicit null dereferenced
    
    and
    
    cid#1509395 Explicit null dereferenced
    
    Change-Id: Ifd8dffe2ff2432ee2f0ef18bb2a480c2f042910b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138674
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/qadevOOo/tests/java/ifc/view/_XMultiSelectionSupplier.java 
b/qadevOOo/tests/java/ifc/view/_XMultiSelectionSupplier.java
index dc775c6e1d8c..c7009a88ab18 100644
--- a/qadevOOo/tests/java/ifc/view/_XMultiSelectionSupplier.java
+++ b/qadevOOo/tests/java/ifc/view/_XMultiSelectionSupplier.java
@@ -318,21 +318,27 @@ public class _XMultiSelectionSupplier extends 
MultiMethodTest {
             Object shouldElement = selections[i];
             i++;
 
-            if (ObjCompare != null) {
-                compRes = ObjCompare.compare(shouldElement, nextElement) == 0;
-            } else {
-                compRes = util.ValueComparer.equalValue(shouldElement, 
nextElement);
-            }
+            if (nextElement != null)
+            {
+                if (ObjCompare != null) {
+                    compRes = ObjCompare.compare(shouldElement, nextElement) 
== 0;
+                } else {
+                    compRes = util.ValueComparer.equalValue(shouldElement, 
nextElement);
+                }
 
-            log.println("nextElement()-object and expected object 
'selections["+i+"]' are equal: "+compRes);
+                log.println("nextElement()-object and expected object 
'selections["+i+"]' are equal: "+compRes);
 
-            if (!compRes && (selections[i]) instanceof Object[]) {
-                if (((Object[])selections[i])[0] instanceof Integer) {
-                    log.println("Getting: "+((Integer) 
((Object[])shouldElement)[0]).intValue());
-                    log.println("Expected: "+((Integer) 
((Object[])selections[i])[0]).intValue());
+                if (!compRes && (selections[i]) instanceof Object[]) {
+                    if (((Object[])selections[i])[0] instanceof Integer) {
+                        log.println("Getting: "+((Integer) 
((Object[])shouldElement)[0]).intValue());
+                        log.println("Expected: "+((Integer) 
((Object[])selections[i])[0]).intValue());
+                    }
                 }
+                bOK &= compRes;
+
+            } else {
+                bOK = false;
             }
-            bOK &= compRes;
         }
 
         tRes.tested("createSelectionEnumeration()", bOK);
@@ -389,21 +395,27 @@ public class _XMultiSelectionSupplier extends 
MultiMethodTest {
             Object shouldElement = selections[i];
             i--;
 
-            if (ObjCompare != null) {
-                compRes = ObjCompare.compare(shouldElement, nextElement) == 0;
-            } else {
-                compRes = util.ValueComparer.equalValue(shouldElement, 
nextElement);
-            }
+            if (nextElement != null) {
+                if (ObjCompare != null) {
+                    compRes = ObjCompare.compare(shouldElement, nextElement) 
== 0;
+                } else {
+                    compRes = util.ValueComparer.equalValue(shouldElement, 
nextElement);
+                }
 
-            log.println("nextElement()-object and expected object 
'selections["+i+"]' are equal: "+compRes);
+                log.println("nextElement()-object and expected object 
'selections["+i+"]' are equal: "+compRes);
 
-            if (!compRes && (selections[i]) instanceof Object[]){
-                if (((Object[])selections[i])[0] instanceof Integer) {
-                    log.println("Getting: "+((Integer) 
((Object[])shouldElement)[0]).intValue());
-                    log.println("Expected: "+((Integer) 
((Object[])selections[i])[0]).intValue());
+                if (!compRes && (selections[i]) instanceof Object[]){
+                    if (((Object[])selections[i])[0] instanceof Integer) {
+                        log.println("Getting: "+((Integer) 
((Object[])shouldElement)[0]).intValue());
+                        log.println("Expected: "+((Integer) 
((Object[])selections[i])[0]).intValue());
+                    }
                 }
+                bOK &= compRes;
+
+            } else {
+                bOK = false;
             }
-            bOK &= compRes;
+
         }
 
         tRes.tested("createReverseSelectionEnumeration()", bOK);

Reply via email to