From e21c384a9c7163625dc22b8b5d74b488b80cabf5 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Fri, 12 Oct 2018 16:51:09 -0500 Subject: [PATCH] Fix bug in ConbinationStream when reading across boundaries --- LibHac/Streams/CombinationStream.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/LibHac/Streams/CombinationStream.cs b/LibHac/Streams/CombinationStream.cs index e37a3883..9dd350e6 100644 --- a/LibHac/Streams/CombinationStream.cs +++ b/LibHac/Streams/CombinationStream.cs @@ -83,7 +83,7 @@ namespace LibHac.Streams break; } int idx = 0; - while (idx+1 < _streamsStartPos.Count) + while (idx + 1 < _streamsStartPos.Count) { if (_streamsStartPos[idx + 1] > pos) { @@ -122,10 +122,11 @@ namespace LibHac.Streams if (count > 0) { - if (_currentStreamIndex >= _streams.Count) + if (_currentStreamIndex + 1 >= _streams.Count) break; - _currentStream = _streams[_currentStreamIndex++]; + _currentStream = _streams[_currentStreamIndex + 1]; + _currentStreamIndex++; _currentStream.Position = 0; } }