Skip to content

Commit

Permalink
Check if power-supply properties are available before using them
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaellehmkuhl committed Sep 1, 2023
1 parent dc05333 commit 2bb94c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/mini-widgets/BatteryIndicator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ import { useMainVehicleStore } from '@/stores/mainVehicle'
const store = useMainVehicleStore()
const voltageDisplayValue = computed(() => {
if (store.powerSupply.voltage === undefined) return NaN
if (store?.powerSupply?.voltage === undefined) return NaN
return Math.abs(store.powerSupply.voltage) >= 100
? store.powerSupply.voltage.toFixed(0)
: store.powerSupply.voltage.toFixed(1)
})
const currentDisplayValue = computed(() => {
if (store.powerSupply.current === undefined) return NaN
if (store?.powerSupply?.current === undefined) return NaN
return Math.abs(store.powerSupply.current) >= 100
? store.powerSupply.current.toFixed(0)
: store.powerSupply.current.toFixed(1)
Expand Down

0 comments on commit 2bb94c9

Please sign in to comment.