assuming that 'MyData' is a custom property there is no way we change that in the RadDiagram code. The Source property will return the shape where the connection starts and is presumably a custom shape. If the Source of the connection is indeed of type 'MyShape' and its 'MyData' is null, it means you have not set it. If 'source' is null then it means the Source shape is not of the 'MyShape' type, but then you would get an exception trying to access the 'MyData' property on the null instance.
Unless you show only part of the code and there is some more logic/code in the loop?
the Telerik team