Skip to content

Commit

Permalink
Fixed the ArrayOutOfBoundException happening for the north direction
Browse files Browse the repository at this point in the history
Signed-off-by: jk KPADEY <[email protected]>
  • Loading branch information
mivek committed Feb 26, 2021
1 parent f398f84 commit e13bf66
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static String degreesToDirection(final String degreesStr) {
return Messages.getInstance().getString("Converter.VRB");
}

return Messages.getInstance().getString("Converter." + DIRECTIONS[(int) ((degrees + 11.5) / 22.5)]);
return Messages.getInstance().getString("Converter." + DIRECTIONS[(int) ((degrees + 11.5) / 22.5) % DIRECTIONS.length]);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public static Collection<Object[]> data() {
{ "Converter.SW", "230" },
{ "Converter.N", "2" },
{ "Converter.NNW", "345" },
{ "Converter.N", "350" },
{"Converter.VRB","anyString"}
});
}
Expand Down

0 comments on commit e13bf66

Please sign in to comment.