Skip to content

guard against undefined previousValue on first network reading - #578

Open
ThorOdinson246 wants to merge 1 commit into
corecoding:mainfrom
ThorOdinson246:fix-vitals-previousvalue-typeerror
Open

guard against undefined previousValue on first network reading#578
ThorOdinson246 wants to merge 1 commit into
corecoding:mainfrom
ThorOdinson246:fix-vitals-previousvalue-typeerror

Conversation

@ThorOdinson246

Copy link
Copy Markdown

Small one. values.js reads previousValue[1] before checking there is a previous value,
so the first time an interface shows up it throws:

TypeError: can't access property 1, previousValue is undefined

The .catch in sensors.js swallows it, so all you see is one missing reading for that
interface. Not a big deal on its own, but it happens for every new interface, which adds up
with docker or a VPN.

Guarded with a ternary.

Together with #577 this also sorts out the negative speeds in #545. That one needs both, so
I've left the closing keyword off it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant