From 48680942fd4f4d90a3d121e6da7f9f8d47dd01da Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sat, 6 Dec 2014 19:56:21 +0100 Subject: [PATCH] Avoid undefined variables. --- actions/apitimelineuser.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php index b105a29dd1..26c960fa04 100644 --- a/actions/apitimelineuser.php +++ b/actions/apitimelineuser.php @@ -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));