diff --git a/src/main/java/org/openflow/protocol/OFFlowRemoved.java b/src/main/java/org/openflow/protocol/OFFlowRemoved.java
index 4f4e0c7ff92acbd9a716c5301bdcd93a06335ae4..33570063c73850cf995606890ac0c3e9e97f67f5 100644
--- a/src/main/java/org/openflow/protocol/OFFlowRemoved.java
+++ b/src/main/java/org/openflow/protocol/OFFlowRemoved.java
@@ -194,7 +194,11 @@ public class OFFlowRemoved extends OFMessage {
         this.match.readFrom(data);
         this.cookie = data.readLong();
         this.priority = data.readShort();
-        this.reason = OFFlowRemovedReason.values()[(0xff & data.readByte())];
+        int reasonIndex = (int)(0xff & data.readByte());
+        if (reasonIndex >= OFFlowRemovedReason.values().length) {
+            reasonIndex = OFFlowRemovedReason.values().length - 1;
+        }
+        this.reason = OFFlowRemovedReason.values()[reasonIndex];
         data.readByte(); // pad
         this.durationSeconds = data.readInt();
         this.durationNanoseconds = data.readInt();