From 65adbc1c0bf82394685a3b6af8ec0a2558602c7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BChlegger?= Date: Tue, 26 Nov 2024 13:03:02 +0100 Subject: [PATCH] Check length of blockdescription before extracting the title and the description. Length can be 0 in some cases --- .../DataTypes/Projectfolders/Step7V5/BlocksOfflineFolder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LibNoDaveConnectionLibrary/DataTypes/Projectfolders/Step7V5/BlocksOfflineFolder.cs b/LibNoDaveConnectionLibrary/DataTypes/Projectfolders/Step7V5/BlocksOfflineFolder.cs index 063dafa2..c74c0d4b 100644 --- a/LibNoDaveConnectionLibrary/DataTypes/Projectfolders/Step7V5/BlocksOfflineFolder.cs +++ b/LibNoDaveConnectionLibrary/DataTypes/Projectfolders/Step7V5/BlocksOfflineFolder.cs @@ -641,7 +641,7 @@ public Block GetBlock(ProjectBlockInfo blkInfo, S7ConvertingOptions myConvOpt) retVal.Parameter = Parameter.GetInterfaceOrDBFromStep7ProjectString(myTmpBlk.blkinterface, ref ParaList, blkInfo.BlockType, false, this, retVal, myConvOpt); } - if (myTmpBlk.blockdescription != null) + if (myTmpBlk.blockdescription != null && myTmpBlk.blockdescription.Length > 3) { retVal.Title = Project.ProjectEncoding.GetString(myTmpBlk.blockdescription, 3, myTmpBlk.blockdescription[1] - 4); retVal.Description = Project.ProjectEncoding.GetString(myTmpBlk.blockdescription, myTmpBlk.blockdescription[1], myTmpBlk.blockdescription.Length - myTmpBlk.blockdescription[1] - 1).Replace("\n", Environment.NewLine);