Hi
I have a usercontrol on which I check the media of a media picker property.
However, when a media item is selected with the media picker and the media is then deleted in the media archive, an error occures.
The error is as follows:
Quote:Object reference not set to an instance of an object.
And the line causing the error is this:
Code:
strLink = objFile.Current.SelectSingleNode("/node/data [@alias='umbracoFile']").InnerXml
Before that, objFile is declared like this:
Code:Dim objFile As System.Xml.XPath.XPathNodeIterator = umbraco.library.GetMedia(intMediaId, False)
intMediaId is the id of the media item selected in the media picker.
It's working fine when the media is still in the media archive, but if you delete it before removing the reference the error above is raised.
How do I check if the media item still exists in the media archive?
objFile Is Nothing does not work.