diff --git a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/I2C.java b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/I2C.java index 40ac136858..a686cef3eb 100644 --- a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/I2C.java +++ b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/I2C.java @@ -76,7 +76,9 @@ public class I2C extends SensorBase { boolean aborted = true; ByteBuffer dataToSendBuffer = ByteBuffer.allocateDirect(sendSize); - dataToSendBuffer.put(dataToSend); + if (sendSize > 0 && dataToSend != null) { + dataToSendBuffer.put(dataToSend); + } ByteBuffer dataReceivedBuffer = ByteBuffer.allocateDirect(receiveSize); aborted =