Răsfoiți Sursa

fixed getTautulliFriendlyNames if error occurs

CauseFX 3 ani în urmă
părinte
comite
2c46911329
1 a modificat fișierele cu 6 adăugiri și 4 ștergeri
  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']);
 		$options = $this->requestOptions($url, null, $this->config['tautulliDisableCertCheck'], $this->config['tautulliUseCustomCertificate']);
 		try {
 		try {
 			$response = Requests::get($url, [], $options);
 			$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) {
 		} catch (Exception $e) {