diff options
author | Zach Copley <zach@controlyourself.ca> | 2009-06-30 15:38:14 -0700 |
---|---|---|
committer | Zach Copley <zach@controlyourself.ca> | 2009-06-30 15:38:14 -0700 |
commit | 190d45cd05a1affbc8d0db50a487b5081f6a34cb (patch) | |
tree | 0c6ceec8fda3de7223b56b1c1f7addf27edde9cd /actions/twitapisearchatom.php | |
parent | c2c631d19dad52e528d633ddd6729bf35d9fd60c (diff) | |
parent | 71dc910a53eb2aba509c418e7ac0f8e9b94cba9a (diff) |
Merge commit 'jeff-themovie/notice-search-no-results' into 0.8.x
* commit 'jeff-themovie/notice-search-no-results':
Fixes the notice search RSS feeds / API results for searches that return no matches.
Diffstat (limited to 'actions/twitapisearchatom.php')
-rw-r--r-- | actions/twitapisearchatom.php | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/actions/twitapisearchatom.php b/actions/twitapisearchatom.php index eb9ab5d8e..708b1494d 100644 --- a/actions/twitapisearchatom.php +++ b/actions/twitapisearchatom.php @@ -165,24 +165,29 @@ class TwitapisearchatomAction extends TwitterapiAction $search_engine->set_sort_mode('chron'); $search_engine->limit(($this->page - 1) * $this->rpp, $this->rpp + 1, true); - $search_engine->query($q); - $this->cnt = $notice->find(); + if (false === $search_engine->query($q)) { + $this->cnt = 0; + } else { + $this->cnt = $notice->find(); + } $cnt = 0; - while ($notice->fetch()) { + if ($this->cnt > 0) { + while ($notice->fetch()) { - ++$cnt; + ++$cnt; - if (!$this->max_id) { - $this->max_id = $notice->id; - } + if (!$this->max_id) { + $this->max_id = $notice->id; + } - if ($cnt > $this->rpp) { - break; - } + if ($cnt > $this->rpp) { + break; + } - $notices[] = clone($notice); + $notices[] = clone($notice); + } } return $notices; |