[vhffs-dev] [1519] Should fix internal server error on tag request list when object or user has been deleted

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1519
Author:   beuss
Date:     2009-08-19 19:32:23 +0200 (Wed, 19 Aug 2009)

Log Message:
-----------
Should fix internal server error on tag request list when object or user has been deleted

Modified Paths:
--------------
    trunk/vhffs-panel/admin/tag/request/list.pl


Modified: trunk/vhffs-panel/admin/tag/request/list.pl
===================================================================
--- trunk/vhffs-panel/admin/tag/request/list.pl	2009-08-07 08:06:51 UTC (rev 1518)
+++ trunk/vhffs-panel/admin/tag/request/list.pl	2009-08-19 17:32:23 UTC (rev 1519)
@@ -64,8 +64,17 @@
 
 my $requests = Vhffs::Tag::Request::get_all($panel->{vhffs});
 foreach my $r (@$requests) {
-	$r->{user} = $r->get_requester->get_username;
-	$r->{object} = $r->get_tagged->get_label;
+	if(defined $r->get_requester) {
+		$r->{user} = $r->get_requester->get_username ;
+	} else {
+		$r->{user} = gettext('DELETED');
+	}
+
+	if(defined $r->{object}) {
+		$r->{object} = $r->get_tagged->get_label;
+	} else {
+		$r->{object} = gettext('DELETED');
+	}
 	my $dt = DateTime->from_epoch( epoch => $r->{created}, locale => $user->get_lang);
 	$r->{created} = $dt->strftime($loc->medium_date_format().' '.$loc->long_time_format());
 }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/