From 2c80c501c6709d15f86afdbc7d3e6194121e0402 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Sun, 9 May 2010 15:05:41 -0700 Subject: [PATCH] Test assets for valid methods before calling them. --- lib/WebGUI/Macro/FileUrl.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/WebGUI/Macro/FileUrl.pm b/lib/WebGUI/Macro/FileUrl.pm index b52fa238f..b9adc624b 100644 --- a/lib/WebGUI/Macro/FileUrl.pm +++ b/lib/WebGUI/Macro/FileUrl.pm @@ -48,11 +48,11 @@ sub process { if (Exception::Class->caught()) { return $i18n->get('invalid url'); } - my $storageId = $asset->storageId; + my $storageId = $asset->can('storageId') ? $asset->storageId : undef; if (not defined $storageId) { return $i18n->get('no storage'); } - my $filename = $asset->filename; + my $filename = $asset->can('filename') ? $asset->filename : undef; if (not defined $filename) { return $i18n->get('no filename'); }