diff --git a/kernel/classes/ezcontentobject.php b/kernel/classes/ezcontentobject.php index 157713b87e3..77254308aa5 100644 --- a/kernel/classes/ezcontentobject.php +++ b/kernel/classes/ezcontentobject.php @@ -2833,6 +2833,14 @@ function addContentObjectRelation( $toObjectID, "eZContentObject::addContentObjectRelation" ); return false; } + + if ( !eZContentObject::exists( $toObjectID ) ) + { + eZDebug::writeError( "Related object ID (toObjectID): '$toObjectID', does not refer to any existing object.", + "eZContentObject::addContentObjectRelation" ); + return false; + } + $fromObjectID =(int) $fromObjectID; $attributeID =(int) $attributeID; $fromObjectVersion =(int) $fromObjectVersion;