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/21 07:54:09 UTC

[plc4x] branch develop updated: - Fixed a tiny bug in the handling of string fields.

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


The following commit(s) were added to refs/heads/develop by this push:
     new cda916d  - Fixed a tiny bug in the handling of string fields.
cda916d is described below

commit cda916d32cee28853d8b49cbfe5a76a2dfa3dd70
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Fri Aug 21 09:53:58 2020 +0200

    - Fixed a tiny bug in the handling of string fields.
---
 .../org/apache/plc4x/java/s7/readwrite/protocol/S7ProtocolLogic.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/readwrite/protocol/S7ProtocolLogic.java b/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/readwrite/protocol/S7ProtocolLogic.java
index 8e870f7..ad246e6 100644
--- a/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/readwrite/protocol/S7ProtocolLogic.java
+++ b/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/readwrite/protocol/S7ProtocolLogic.java
@@ -556,7 +556,7 @@ public class S7ProtocolLogic extends Plc4xProtocolBase<TPKTPacket> {
         }
         if(transportSize == TransportSize.STRING) {
             transportSize = TransportSize.CHAR;
-            int stringLength = ((S7StringField) s7Field).getStringLength();
+            int stringLength = (s7Field instanceof S7StringField) ? ((S7StringField) s7Field).getStringLength() : 254;
             numElements = numElements * (stringLength + 2);
         }
         return new S7AddressAny(transportSize, numElements, s7Field.getBlockNumber(),