Skip to content

Commit

Permalink
Fix #33.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladislav Kochedykov authored and kochedykov committed Feb 14, 2019
1 parent ad405ad commit 38fcf02
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/com/intelligt/modbus/jlibmodbus/Modbus.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ static public boolean checkEndAddress(int value) {
* @return "true" if register value is correct, else "false".
*/
static public boolean checkRegisterValue(int value) {
return checkRange(value, 0, Modbus.MAX_REGISTER_VALUE);
return checkRange((short)value, 0, Modbus.MAX_REGISTER_VALUE);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ private void checkRange(int offset, int quantity) throws IllegalDataAddressExcep
}

private void checkAddress(int offset) throws IllegalDataAddressException {
if (offset > (getQuantity() - 1))
if (DataUtils.wordLow(offset) > (getQuantity() - 1))
throw new IllegalDataAddressException(offset);
}

Expand Down

0 comments on commit 38fcf02

Please sign in to comment.