Merge pull request #99 from ff-meli/master

This commit is contained in:
goaaats 2020-04-26 23:48:44 +02:00 committed by GitHub
commit 299ca5daca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View file

@ -30,7 +30,10 @@ namespace Dalamud.Game.Chat.SeStringHandling
public static Payload Process(BinaryReader reader)
{
Payload payload = null;
if ((byte)reader.PeekChar() != START_BYTE)
var initialByte = reader.ReadByte();
reader.BaseStream.Position--;
if (initialByte != START_BYTE)
{
payload = ProcessText(reader);
}

View file

@ -58,11 +58,15 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads
while (reader.BaseStream.Position < endOfStream)
{
if ((byte)reader.PeekChar() == START_BYTE)
var nextByte = reader.ReadByte();
if (nextByte == START_BYTE)
{
// rewind since this byte isn't part of this payload
reader.BaseStream.Position--;
break;
}
// not the most efficient, but the easiest
text.Add(reader.ReadByte());
text.Add(nextByte);
}
if (text.Count > 0)