summaryrefslogtreecommitdiff
path: root/src/net/tmwa/messagein.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/tmwa/messagein.h')
-rw-r--r--src/net/tmwa/messagein.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/net/tmwa/messagein.h b/src/net/tmwa/messagein.h
index 48121187..2f66ca28 100644
--- a/src/net/tmwa/messagein.h
+++ b/src/net/tmwa/messagein.h
@@ -50,7 +50,10 @@ class MessageIn
/**
* Returns the length of unread data.
*/
- unsigned int getUnreadLength() const { return mLength - mPos; }
+ unsigned int getUnreadLength() const
+ {
+ return (mPos < mLength) ? mLength - mPos : 0;
+ }
/**
* Reads an unsigned 8-bit integer from the message.