Skip to content

Commit

Permalink
fix: null handling in windDirectionMagnetic.js
Browse files Browse the repository at this point in the history
  • Loading branch information
tkurki committed Jul 27, 2024
1 parent 1ff3e04 commit 5c5f05d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion calcs/windDirectionMagnetic.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = function (app, plugin) {
'navigation.magneticVariation'
],
calculator: function (directionTrue, magneticVariation) {
if (directionTrue === null) {
if (directionTrue === null || magneticVariation === null) {
return [{ path: 'environment.wind.directionMagnetic', value: null }]
}
var directionMagnetic = directionTrue - magneticVariation
Expand All @@ -25,6 +25,10 @@ module.exports = function (app, plugin) {
{
input: [null, -0.01],
expected: [{ path: 'environment.wind.directionMagnetic', value: null }]
},
{
input: [0.2, null],
expected: [{ path: 'environment.wind.directionMagnetic', value: null }]
}
]
}
Expand Down

0 comments on commit 5c5f05d

Please sign in to comment.