diff --git a/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java b/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java index 930b6d7074..d23da56c9c 100644 --- a/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java +++ b/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java @@ -20,6 +20,7 @@ import java.io.IOException; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.Arrays; +import java.util.Objects; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; @@ -393,6 +394,10 @@ public class BinaryProtocol implements BinaryProtocolCommands { currentOutputs = response; for (Sensor sensor : Sensor.values()) { + if (sensor.getType() == null) { + // for example ETB_CONTROL_QUALITY, weird use-case + continue; + } ByteBuffer bb = ByteBuffer.wrap(response, 1 + sensor.getOffset(), 4); bb.order(ByteOrder.LITTLE_ENDIAN); @@ -404,6 +409,9 @@ public class BinaryProtocol implements BinaryProtocolCommands { } private static double getValueForChannel(ByteBuffer bb, Sensor sensor) { + Objects.requireNonNull(sensor, "sensor"); + if (sensor.getType() == null) + throw new NullPointerException("sensor type " + sensor); switch (sensor.getType()) { case FLOAT: return bb.getFloat();