[Jifty-commit] r5370 - in jifty/trunk: lib/Jifty
Jifty commits
jifty-commit at lists.jifty.org
Wed May 7 03:42:54 EDT 2008
Author: sartak
Date: Wed May 7 03:42:54 2008
New Revision: 5370
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Action.pm
Log:
r55199 at onn: sartak | 2008-05-07 03:42:16 -0400
Check that the collection has a count before using ->first
Modified: jifty/trunk/lib/Jifty/Action.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action.pm (original)
+++ jifty/trunk/lib/Jifty/Action.pm Wed May 7 03:42:54 2008
@@ -1098,11 +1098,13 @@
my $disp = $v->{'display_from'};
my $val = $v->{'value_from'};
- unless ($v->{'collection'}->first->can($disp)) {
- Jifty->log->error("Invalid 'display_from' of $disp on $field");
- }
- unless ($v->{'collection'}->first->can($val)) {
- Jifty->log->error("Invalid 'value_from' of $val on $field");
+ if ($v->{'collection'}->count) {
+ unless ($v->{'collection'}->first->can($disp)) {
+ Jifty->log->error("Invalid 'display_from' of $disp on $field");
+ }
+ unless ($v->{'collection'}->first->can($val)) {
+ Jifty->log->error("Invalid 'value_from' of $val on $field");
+ }
}
# XXX TODO: wrap this in an eval?
More information about the Jifty-commit
mailing list