Skip to content

Commit

Permalink
Return null if CIF_speed is not defined (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
Juhani Pirttilahti committed Feb 23, 2023
1 parent 42a7286 commit 14b69e7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion models/vstp.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ function parsets(ts) {
}

function parsespeed(CIF_speed) {
const speed = +CIF_speed;
// set null if attribute is missing
if (CIF_speed === undefined) {
return null;
}
let speed = parseInt(CIF_speed) || 0;
// fix speed values in incorrect unit
switch (speed) {
case 22:
return 10;
Expand Down

0 comments on commit 14b69e7

Please sign in to comment.