diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2018-10-30 23:40:20 +0300 |
---|---|---|
committer | Stefan Giehl <stefan@piwik.org> | 2018-10-30 23:40:20 +0300 |
commit | 06bf824590aa18d0425dba83b9e49d7c2394d1af (patch) | |
tree | 4e8423ee30cda167f3caef5c1f04b37335ca7167 /plugins/Live | |
parent | c289385a275ed2c22c224d40191b328c97f3064c (diff) |
Fix possible error in visitor profile when no visit found (#13549)
Not tested but fix this fatal error
> Error: {"message":"Call to a member function getColumn() on boolean","file":"plugins\/Live\/VisitorProfile.php","line":86}
Happened eg on
> module=API&method=Live.getVisitorProfile&idSite=1&format=JSON&token_auth=XYZANONYMIZED&visitorId=b06bc6d6274c1244&limitVisits=-1
Diffstat (limited to 'plugins/Live')
-rw-r--r-- | plugins/Live/VisitorProfile.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/Live/VisitorProfile.php b/plugins/Live/VisitorProfile.php index 1e432bb395..1a7236a157 100644 --- a/plugins/Live/VisitorProfile.php +++ b/plugins/Live/VisitorProfile.php @@ -79,6 +79,11 @@ class VisitorProfile */ private function handleAdjacentVisitorIds(DataTable $visits, $visitorId, $segment) { + if (!$visits->getRowsCount()) { + $this->profile['nextVisitorId'] = false; + $this->profile['previousVisitorId'] = false; + return; + } // get visitor IDs that are adjacent to this one in log_visit // TODO: make sure order of visitor ids is not changed if a returning visitor visits while the user is // looking at the popup. @@ -91,4 +96,4 @@ class VisitorProfile $this->profile['previousVisitorId'] = $model->queryAdjacentVisitorId($this->idSite, $visitorId, $latestVisitTime, $segment, $getNext = false); } -}
\ No newline at end of file +} |