Skip to content

Commit

Permalink
Add ID check, since that's important.
Browse files Browse the repository at this point in the history
  • Loading branch information
Luyten-Orion committed Sep 4, 2024
1 parent 3e283f0 commit 1fe8743
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modernnet.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "3.2.1"
version = "3.2.2"
author = "Luyten Orion"
description = "ModernNet implements a packet reading and writing system, as well as some useful tools for implementing this into your own project!"
license = "Apache-2.0"
Expand Down
3 changes: 3 additions & 0 deletions src/modernnet/io.nim
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ func readRawPacket*(data: openArray[byte]): Result[tuple[packet: RawPacket, byte

let id = data[length.ok.bytesRead..^1].readVar[:int32]()

if not id.isOk:
return typeof(result)(isOk: false, err: id.err)

typeof(result)(isOk: true, ok: (
RawPacket(id: id.ok.num, buf: newBuffer(data[(length.ok.bytesRead + id.ok.bytesRead)..^1])),
length.ok.bytesRead + length.ok.num
Expand Down

0 comments on commit 1fe8743

Please sign in to comment.