Skip to content

Commit d641138

Browse files
committed
Moving the buffer.align() into the game event try block.
1 parent df692fe commit d641138

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

sc2reader/readers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,11 @@ def __call__(self, buffer, replay):
237237
parser = PARSERS[type](code)
238238
event = parser(buffer, frames, type, code, pid)
239239

240+
# Because events are parsed in a bitwise fashion, they sometimes
241+
# leave the buffer in a bitshifted state. Each new event always
242+
# starts byte aligned so make sure that the buffer does too.
243+
align()
244+
240245
# For debugging purposes, we may wish to record the event.bytes
241246
# associated with this event; including the event header bytes.
242247
if debug:
@@ -259,11 +264,6 @@ def __call__(self, buffer, replay):
259264
except ReadError as e:
260265
raise ReadError(e.msg, replay, game_events, buffer, start)
261266

262-
# Because events are parsed in a bitwise fashion, they sometimes
263-
# leave the buffer in a bitshifted state. Each new event always
264-
# starts byte aligned so make sure that the buffer does too.
265-
align()
266-
267267
return game_events
268268

269269
def get_setup_parser(self, code):

0 commit comments

Comments
 (0)