summaryrefslogtreecommitdiff
path: root/actions/twitapisearchatom.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-07-01 12:58:49 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-07-01 12:58:49 -0400
commit721ba6c88f3c89c3efcc8e5f0c9169d94911825d (patch)
treef1b07dfc50858d98258a3043e3c6dbf4f00a22e3 /actions/twitapisearchatom.php
parent8a8390c1a78a2586bb2e9e10bfcb3502739d8d76 (diff)
parent6c28a07cf58120e271de6e0c9c89a1f9a6d0101e (diff)
Merge branch '0.8.x' of git@gitorious.org:+laconica-developers/laconica/dev into 0.8.x
Diffstat (limited to 'actions/twitapisearchatom.php')
-rw-r--r--actions/twitapisearchatom.php28
1 files changed, 17 insertions, 11 deletions
diff --git a/actions/twitapisearchatom.php b/actions/twitapisearchatom.php
index eb9ab5d8e..3678213c3 100644
--- a/actions/twitapisearchatom.php
+++ b/actions/twitapisearchatom.php
@@ -165,24 +165,30 @@ 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;
+ $this->max_id = 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;