From ca78e1db4ef1463bd223b348b031b8af007086f9 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Sun, 16 Sep 2012 20:51:18 -0700 Subject: [PATCH] Spectre is touchy about things that die in perl. Fix the UpdateAssetSubscribers workflow activity to catch if the group in the asset does not exist. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Workflow/Activity/UpdateAssetSubscribers.pm | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 3f3fae37b..ac54899c7 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -7,6 +7,7 @@ - fixed #12362: Thingy default Y/N field overly default - fixed #12385: UTF-8 characters in Asset title break the Trash - fixed ... and the same problem in the Clipboard + - fixed: UpdateAssetSubscribers workflow activity ERRORs if the group cannot be found. 7.10.26 - fixed: Template diagnostics when called without a session asset. diff --git a/lib/WebGUI/Workflow/Activity/UpdateAssetSubscribers.pm b/lib/WebGUI/Workflow/Activity/UpdateAssetSubscribers.pm index cfc0e24c2..7b7fddd2f 100644 --- a/lib/WebGUI/Workflow/Activity/UpdateAssetSubscribers.pm +++ b/lib/WebGUI/Workflow/Activity/UpdateAssetSubscribers.pm @@ -71,13 +71,18 @@ See WebGUI::Workflow::Activity::execute() for details. sub execute { my $self = shift; my $asset = shift; + my $session = $self->session; return unless $asset->get('subscriptionGroupId'); my $expireTime = time() + $self->getTTL(); - my $subscriptionGroup = WebGUI::Group->new($self->session, $asset->get('subscriptionGroupId')); + my $subscriptionGroup = WebGUI::Group->new($session, $asset->get('subscriptionGroupId')); ##Deserialize from scratch + if (! $subscriptionGroup) { + $session->log->warn("Subscription group is missing for assetId: ".$asset->getId); + return $self->COMPLETE; + } my @users = @{ $subscriptionGroup->getUsers }; ##Cache my @usersToDelete = (); ##Cache ##Note, we could use grep here, but we can't interrupt if the workflow runs too long