diff --git a/ihmc-communication/src/main/java/us/ihmc/communication/controllerAPI/CommandInputManager.java b/ihmc-communication/src/main/java/us/ihmc/communication/controllerAPI/CommandInputManager.java index fe1e21edf71a..13c6a6385159 100644 --- a/ihmc-communication/src/main/java/us/ihmc/communication/controllerAPI/CommandInputManager.java +++ b/ihmc-communication/src/main/java/us/ihmc/communication/controllerAPI/CommandInputManager.java @@ -218,11 +218,11 @@ private void submitMessageInternal(Settable message) LogTools.error("{}The message type {} is not supported.", printStatementPrefix, message.getClass().getSimpleName()); return; } - Command nextCommand = (Command) buffer.next(); - if (nextCommand == null) + Command nextCommand; + while ((nextCommand = (Command) buffer.next()) == null) { - LogTools.warn("{}The buffer for the message: {} is full. Message ignored.", printStatementPrefix, message.getClass().getSimpleName()); - return; + buffer.poll(); + LogTools.warn("{}The buffer for the message: {} is full. Ignoring oldest message.", printStatementPrefix, message.getClass().getSimpleName()); } Class commandClass = nextCommand.getClass();