Skip to content

Commit 65adbc1

Browse files
committed
Check length of blockdescription before extracting the title and the description. Length can be 0 in some cases
1 parent 94cf6df commit 65adbc1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

LibNoDaveConnectionLibrary/DataTypes/Projectfolders/Step7V5/BlocksOfflineFolder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ public Block GetBlock(ProjectBlockInfo blkInfo, S7ConvertingOptions myConvOpt)
641641
retVal.Parameter = Parameter.GetInterfaceOrDBFromStep7ProjectString(myTmpBlk.blkinterface, ref ParaList, blkInfo.BlockType, false, this, retVal, myConvOpt);
642642
}
643643

644-
if (myTmpBlk.blockdescription != null)
644+
if (myTmpBlk.blockdescription != null && myTmpBlk.blockdescription.Length > 3)
645645
{
646646
retVal.Title = Project.ProjectEncoding.GetString(myTmpBlk.blockdescription, 3, myTmpBlk.blockdescription[1] - 4);
647647
retVal.Description = Project.ProjectEncoding.GetString(myTmpBlk.blockdescription, myTmpBlk.blockdescription[1], myTmpBlk.blockdescription.Length - myTmpBlk.blockdescription[1] - 1).Replace("\n", Environment.NewLine);

0 commit comments

Comments
 (0)