When does property ID from ContentReference return 0 (Zero)?
I ask becuase sometimes I hava a exception when I execute this line, although I have object ContentReference.
The exception appers when I have ID = 0
If you've had some deleted content that was linked to or a property hasn't been set you may get an Empty content reference. It's best practice when using any ContentReference to call ContentReference.IsNullOrEmpty first as a check to make sure it's not an empty reference as if you try to load it you'll get an error.
Either do that null check or use IContentLoader.TryGet(ContentReference contentLink, out TContentType content). TryGet has that ContentReference.IsNullOrEmpty check internally and returns false in that case and content is set to null.