From cdddc6010c81dec4a001700aeda29a83027219e4 Mon Sep 17 00:00:00 2001 From: Rafael Araujo Lehmkuhl Date: Thu, 16 Nov 2023 17:42:31 -0300 Subject: [PATCH] Verify if imported profiles from vehicle are indeed profiles --- src/stores/widgetManager.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/stores/widgetManager.ts b/src/stores/widgetManager.ts index 1f6a8cd90..4d77e391b 100644 --- a/src/stores/widgetManager.ts +++ b/src/stores/widgetManager.ts @@ -168,6 +168,10 @@ export const useWidgetManagerStore = defineStore('widget-manager', () => { vehicleStore.globalAddress, 'cockpit-saved-profiles-v7' ) + if (!Array.isArray(newProfiles) || !newProfiles.every((profile) => isProfile(profile))) { + Swal.fire({ icon: 'error', text: 'Could not import profiles from vehicle. Invalid data.', timer: 3000 }) + return + } savedProfiles.value = newProfiles Swal.fire({ icon: 'success', text: 'Cockpit profiles imported from vehicle.', timer: 3000 }) }