diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index ad37b0280..d53afcdf6 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -2,6 +2,7 @@ - fixed #11693: Shopping cart does not show for visitor user - fixed: missing per-item template variables for the cart. - fixed #11696: WebGUI 7.9.8 gotcha + - fixed #11698: Trash dies on missing or bad workflow 7.9.8 - fixed #11651: First Day of Week is a string... diff --git a/lib/WebGUI/AssetTrash.pm b/lib/WebGUI/AssetTrash.pm index a22acbeaa..f6c7110a5 100644 --- a/lib/WebGUI/AssetTrash.pm +++ b/lib/WebGUI/AssetTrash.pm @@ -298,11 +298,16 @@ sub _invokeWorkflowOnExportedFiles { if ($workflowId) { my ($lastExportedAs) = $self->get("lastExportedAs"); my $wfInstance = WebGUI::Workflow::Instance->create($self->session, { workflowId => $workflowId }); - $wfInstance->setScratch( - WebGUI::Workflow::Activity::DeleteExportedFiles::DELETE_FILES_SCRATCH() => - Storable::freeze([ defined($lastExportedAs) ? ($lastExportedAs) : () ]) - ); - $wfInstance->start(1); + if ($wfInstance) { + $wfInstance->setScratch( + WebGUI::Workflow::Activity::DeleteExportedFiles::DELETE_FILES_SCRATCH() => + Storable::freeze([ defined($lastExportedAs) ? ($lastExportedAs) : () ]) + ); + $wfInstance->start(1); + } + else { + $self->session->log->warn('The Purge Workflow from the settings has been deleted and cannot be run.'); + } } }