summaryrefslogtreecommitdiff
path: root/src/net/manaserv/messagein.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/manaserv/messagein.h')
-rw-r--r--src/net/manaserv/messagein.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/net/manaserv/messagein.h b/src/net/manaserv/messagein.h
index 89ae5ed8..1edc4fe7 100644
--- a/src/net/manaserv/messagein.h
+++ b/src/net/manaserv/messagein.h
@@ -52,7 +52,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.