Skip to content

Commit c75bbd5

Browse files
authored
Merge pull request #204 from trojanobelix/feat-chkPDOMappingSubValid
Check if the sub index for PDO mapping is still valid (might be deleted)
2 parents 18daafd + 4017078 commit c75bbd5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

libEDSsharp/PDOHelper.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,13 @@ void build_PDOlist(UInt16 startIdx, List<PDOSlot> slots)
366366
}
367367
else
368368
maptarget.entry = eds.ods[pdoindex].Getsubobject(pdosub);
369-
370-
if ((maptarget.entry.prop.CO_disabled == false) &&
369+
// Check if mapped sub index was found in OD
370+
if (maptarget.entry == null)
371+
{
372+
Console.WriteLine("MAPPING FAILED, OBJEKT NOT FOUND");
373+
continue;
374+
}
375+
else if ((maptarget.entry.prop.CO_disabled == false) &&
371376
(datasize <= maptarget.entry.Sizeofdatatype()) &&
372377
(datasize > 0))
373378
{

0 commit comments

Comments
 (0)