]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Avoid undefined variables.
authorMikael Nordfeldth <mmn@hethane.se>
Sat, 6 Dec 2014 18:56:21 +0000 (19:56 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Sat, 6 Dec 2014 18:56:21 +0000 (19:56 +0100)
actions/apitimelineuser.php

index b105a29dd14a5c7f56727d8ade40cbe827d8a95d..26c960fa0429b9e1d176713cd4e65e60be43ddfa 100644 (file)
@@ -134,12 +134,17 @@ class ApiTimelineUserAction extends ApiBareAuthAction
                                           'id' => $this->target->id),
                                     array('max_id' => $this->next_id))
                     : null;
-        $lastNotice = $this->notices[0];
-        $lastId     = $lastNotice->id;
+
+        $prevExtra = array();
+        if (!empty($this->notices)) {
+            assert($this->notices[0] instanceof Notice);
+            $prevExtra['since_id'] = $this->notices[0]->id;
+        }
+
         $prevUrl = common_local_url('ApiTimelineUser',
                                     array('format' => $this->format,
                                           'id' => $this->target->id),
-                                    array('since_id' => $lastId));
+                                    $prevExtra);
         $firstUrl = common_local_url('ApiTimelineUser',
                                     array('format' => $this->format,
                                           'id' => $this->target->id));