|
@@ -186,6 +186,9 @@ public class ButtonBoxClient {
|
|
|
private short read(int slaveId, int offset, int len) {
|
|
|
ModbusMasterUtil modbusMasterUtil = modbusTcpMasterTemplateThird.getModbusMasterUtil();
|
|
|
ReadResponse readResponse = modbusMasterUtil.readHoldingRegisters(slaveId, offset, len);
|
|
|
+ if (readResponse == null) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
short[] shortData = readResponse.getShortData();
|
|
|
return shortData[0];
|
|
|
}
|