summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2011-01-24 00:22:51 +0000
committerivan <ivan>2011-01-24 00:22:51 +0000
commita32c9f2fff7814979894fa1fca729b7dd70f6af7 (patch)
tree94e99d8d6ff6e4487e3d26f4a8c113e1357105f0 /FS
parent08180f31475affb0047af48ef7fd182a55c06d57 (diff)
scalar_sql return an empty string on no row as documented
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Record.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index 2e2612e35..29e5322ef 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -2909,7 +2909,8 @@ sub scalar_sql {
my $sth = dbh->prepare($sql) or die dbh->errstr;
$sth->execute(@_)
or die "Unexpected error executing statement $sql: ". $sth->errstr;
- my $scalar = $sth->fetchrow_arrayref->[0];
+ my $row = $sth->fetchrow_arrayref or return '';
+ my $scalar = $row->[0];
defined($scalar) ? $scalar : '';
}