Browse Source

fixed getTautulliFriendlyNames if error occurs

CauseFX 3 năm trước cách đây
mục cha
commit
2c46911329
1 tập tin đã thay đổi với 6 bổ sung4 xóa
  1. 6 4
      api/homepage/plex.php

+ 6 - 4
api/homepage/plex.php

@@ -663,10 +663,12 @@ trait PlexHomepageItem
 		$options = $this->requestOptions($url, null, $this->config['tautulliDisableCertCheck'], $this->config['tautulliUseCustomCertificate']);
 		try {
 			$response = Requests::get($url, [], $options);
-			$response = json_decode($response->body, true);
-			foreach ($response['response']['data'] as $user) {
-				if ($user['user_id'] != 0) {
-					$names[$user['username']] = $user['friendly_name'];
+			if ($response->success) {
+				$response = json_decode($response->body, true);
+				foreach ($response['response']['data'] as $user) {
+					if ($user['user_id'] != 0) {
+						$names[$user['username']] = $user['friendly_name'];
+					}
 				}
 			}
 		} catch (Exception $e) {