Browse Source

Fixed issue with movies not showing up

Added if(array_search) when unsetting values from homestats array. Without this, when no value is returned, it unsets the first value from the array instead of skipping.
Henry Whitaker 6 years ago
parent
commit
0644a6cb02
1 changed files with 4 additions and 3 deletions
  1. 4 3
      api/functions/homepage-connect-functions.php

+ 4 - 3
api/functions/homepage-connect-functions.php

@@ -2497,9 +2497,10 @@ function getTautulli()
 			}
 			$ids = array_merge(['top_music', 'popular_music', 'last_watched', 'most_concurrent'], $ids);
 			foreach ($ids as $id) {
-				$key = array_search($id, array_column($api['homestats']['data'], 'stat_id'));
-				unset($api['homestats']['data'][$key]);
-				$api['homestats']['data'] = array_values($api['homestats']['data']);
+				if($key = array_search($id, array_column($api['homestats']['data'], 'stat_id'))) {
+					unset($api['homestats']['data'][$key]);
+					$api['homestats']['data'] = array_values($api['homestats']['data']);
+				}
 			}
 		} catch (Requests_Exception $e) {
 			writeLog('error', 'Tautulli Connect Function - Error: ' . $e->getMessage(), 'SYSTEM');