Skip to content
This repository has been archived by the owner on Feb 7, 2018. It is now read-only.

Commit

Permalink
return zero if api share count is zero
Browse files Browse the repository at this point in the history
  • Loading branch information
compeak committed Mar 23, 2015
1 parent 2e56dd6 commit 8d29186
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Heise/Shariff/Service/Facebook.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ sub request {
sub extract_count {
my ($self, $res) = @_;

$self->app->log->debug( dumper($res->json));
if (ref $res->json eq 'ARRAY' && exists $res->json->[0]->{share_count}) {
return $res->json->[0]->{share_count};
}
if (exists $res->json->{share} && $res->json->{share}->{share_count}) {
if (exists $res->json->{share} && defined($res->json->{share}->{share_count})) {
return $res->json->{share}->{share_count};
}
return undef;
Expand Down

0 comments on commit 8d29186

Please sign in to comment.