diff --git a/libEDSsharp/PDOHelper.cs b/libEDSsharp/PDOHelper.cs index 1b71d0db..181ae27e 100644 --- a/libEDSsharp/PDOHelper.cs +++ b/libEDSsharp/PDOHelper.cs @@ -366,8 +366,13 @@ void build_PDOlist(UInt16 startIdx, List slots) } else maptarget.entry = eds.ods[pdoindex].Getsubobject(pdosub); - - if ((maptarget.entry.prop.CO_disabled == false) && + // Check if mapped sub index was found in OD + if (maptarget.entry == null) + { + Console.WriteLine("MAPPING FAILED, OBJEKT NOT FOUND"); + continue; + } + else if ((maptarget.entry.prop.CO_disabled == false) && (datasize <= maptarget.entry.Sizeofdatatype()) && (datasize > 0)) {