You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2020/08/11 13:59:02 UTC

[plc4x] 01/07: - Fixed a bug in the StaticHelper causing NPEs when counting item on null references.

This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 89c63a0cd808edf0ff40ba90fee5ac330b98f1fd
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Tue Aug 11 14:21:37 2020 +0200

    - Fixed a bug in the StaticHelper causing NPEs when counting item on null references.
---
 .../main/java/org/apache/plc4x/java/spi/generation/StaticHelper.java   | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/StaticHelper.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/StaticHelper.java
index 4f0ddb0..5f927dd 100644
--- a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/StaticHelper.java
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/StaticHelper.java
@@ -42,6 +42,9 @@ public class StaticHelper {
     }
 
     public static int COUNT(Object obj) {
+        if(obj == null) {
+            return 0;
+        }
         if (obj.getClass().isArray()) {
             if(obj.getClass().getComponentType() != null && obj.getClass().getComponentType().isPrimitive()) {
                 if(obj.getClass().getComponentType() == boolean.class) {