From b13b7e5f8792cbda7966e07aab2c322d0dd9d6dd Mon Sep 17 00:00:00 2001 From: HighImKevin Date: Mon, 21 Sep 2026 02:53:48 -0400 Subject: [PATCH] Fix null pointer reference --- scripts/apiHelper.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/apiHelper.js b/scripts/apiHelper.js index 623cd7a..7213e65 100644 --- a/scripts/apiHelper.js +++ b/scripts/apiHelper.js @@ -241,10 +241,11 @@ * @returns {string} */ function getAuthHeaderForToken(token) { - const client = typeof ApiClient.applicationName === 'function' ? ApiClient.applicationName() : 'Jellyfin Web'; - const device = typeof ApiClient.deviceName === 'function' ? ApiClient.deviceName() : (navigator.userAgent.includes('Chrome') ? 'Chrome' : 'Browser'); - const deviceId = typeof ApiClient.deviceId === 'function' ? ApiClient.deviceId() : ''; - const version = ApiClient._appVersion || ApiClient._serverVersion || ''; + const api = (typeof ApiClient !== 'undefined' && ApiClient) || window.ApiClient || null; + const client = api && typeof api.applicationName === 'function' ? api.applicationName() : 'Jellyfin Web'; + const device = api && typeof api.deviceName === 'function' ? api.deviceName() : (navigator.userAgent.includes('Chrome') ? 'Chrome' : 'Browser'); + const deviceId = api && typeof api.deviceId === 'function' ? api.deviceId() : ''; + const version = (api && (api._appVersion || api._serverVersion)) || ''; const parts = [ `Client="${encodeURIComponent(client)}"`, `Device="${encodeURIComponent(device)}"`,