Check for lack of existence of an asset before logging an error. Fixes bug #11526

This commit is contained in:
Colin Kuskie 2010-04-19 08:21:19 -07:00
parent ea5e82b626
commit c8414bee52
2 changed files with 7 additions and 3 deletions

View file

@ -98,9 +98,12 @@ sub duplicate {
my $newAsset
= $parent->addChild( $self->get, undef, $self->get("revisionDate"), { skipAutoCommitWorkflows => $options->{skipAutoCommitWorkflows} } );
$self->session->log->error(
sprintf "Unable to add child %s (%s) to %s (%s)", $self->getTitle, $self->getId, $parent->getTitle, $parent->getId
);
if (! $newAsset) {
$self->session->log->error(
sprintf "Unable to add child %s (%s) to %s (%s)", $self->getTitle, $self->getId, $parent->getTitle, $parent->getId
);
return undef;
}
# Duplicate metadata fields
my $sth = $self->session->db->read(
"select * from metaData_values where assetId = ?",