Skip to content

Commit

Permalink
Fix ParseComplete and remove impossible Buffer Null check
Browse files Browse the repository at this point in the history
  • Loading branch information
Seddryck committed Sep 2, 2023
1 parent 8b1d672 commit 7cf92f1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Pgnoli.Testing/Messages/Backend/Query/ParseCompleteTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ParseCompleteTest
[Test]
public void Write_Default_Success()
{
var msg = new ParseComplete();
var msg = ParseComplete.Message.Build();
msg.Write();
var bytes = msg.GetBytes();

Expand Down
6 changes: 3 additions & 3 deletions Pgnoli/Messages/Backend/Query/ParseComplete.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

namespace Pgnoli.Messages.Backend.Query
{
public class ParseComplete : CodeMessage
public sealed class ParseComplete : CodeMessage
{
public const char Code = '1';

protected internal ParseComplete(byte[] bytes)
internal ParseComplete(byte[] bytes)
: base(Code, bytes) { }

protected internal ParseComplete()
internal ParseComplete()
: base(Code) { }

protected override int GetPayloadLength()
Expand Down
3 changes: 0 additions & 3 deletions Pgnoli/Messages/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ internal virtual byte[] Write()

public virtual int Read()
{
if (Buffer is null)
throw new BufferNotAllocatedException();

if (Buffer.Length == 0)
throw new BufferEmptyException();

Expand Down

0 comments on commit 7cf92f1

Please sign in to comment.