Code:
function DoesItemExist(Item)
return pcall (reaper.IsMediaItemSelected, Item)
end
This returns true, if the MediaItem exists or false if it doesn't exist anymore.
If false, the second returnvalue holds the error-message that happened.
(This function doesn't check, if Item is a valid MediaItem, but you can add this using reaper.ValidatePtr() )
Edit: I think, I'll add that to Ultraschall-API as well. This could be helpful I think.