Skip to content

Commit

Permalink
Check length of blockdescription before extracting the title and the …
Browse files Browse the repository at this point in the history
…description. Length can be 0 in some cases
  • Loading branch information
TomMuehlegger committed Nov 26, 2024
1 parent 94cf6df commit 65adbc1
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 65adbc1

Please sign in to comment.