Context
In PR #383, toDirection() was updated to return null for non-finite inputs (NaN, Infinity, null, undefined, etc.). The caller in src/lib/MapHelpers/generateVehicleIcon.js:26 (getDirectionFromOrientation(toDirection(orientation))) relies on JavaScript's implicit null → 0 coercion to default to the "north" icon when orientation data is missing.
Suggestion
Add an explicit null check in createVehicleIconSvg so that when toDirection returns null, the vehicle icon is rendered without a directional arrow (or with a clearly "unknown direction" state) rather than silently defaulting to north.
This is cosmetic — the current behavior matches what happened before the refactor (NaN also defaulted to north) — but an explicit check would be cleaner and prevent confusion for future maintainers.
Context
In PR #383,
toDirection()was updated to returnnullfor non-finite inputs (NaN, Infinity, null, undefined, etc.). The caller insrc/lib/MapHelpers/generateVehicleIcon.js:26(getDirectionFromOrientation(toDirection(orientation))) relies on JavaScript's implicitnull → 0coercion to default to the "north" icon when orientation data is missing.Suggestion
Add an explicit null check in
createVehicleIconSvgso that whentoDirectionreturnsnull, the vehicle icon is rendered without a directional arrow (or with a clearly "unknown direction" state) rather than silently defaulting to north.This is cosmetic — the current behavior matches what happened before the refactor (NaN also defaulted to north) — but an explicit check would be cleaner and prevent confusion for future maintainers.