diff --git a/Source/Client/Replay.cpp b/Source/Client/Replay.cpp index 1ce856683..df70641de 100644 --- a/Source/Client/Replay.cpp +++ b/Source/Client/Replay.cpp @@ -489,16 +489,17 @@ void Replay::ResetFile() { std::vector Replay::ReadSection(int id) { std::vector data; - if (id >= 1 && id <= 25) { - const int index = this->FindSection(id); + if (id < 1 || id > 25) { + return data; + } - if (index != -1 && this->sections[index].fileOffset != 0 && this->sections[index].bytes != 0) { - const ReplaySection& section = this->sections[index]; - data.resize(section.bytes); - std::fseek(this->file, static_cast(section.fileOffset), SEEK_SET); - std::fread(data.data(), section.bytes, 1, this->file); - this->Cipher(section.bytes, data.data()); - } + const int index = this->FindSection(id); + if (index != -1 && this->sections[index].fileOffset != 0 && this->sections[index].bytes != 0) { + const ReplaySection& section = this->sections[index]; + data.resize(section.bytes); + std::fseek(this->file, static_cast(section.fileOffset), SEEK_SET); + std::fread(data.data(), section.bytes, 1, this->file); + this->Cipher(section.bytes, data.data()); } return data; @@ -539,7 +540,7 @@ std::uint32_t Replay::ParseMetadata(const std::vector& data) { if (this->header.signature != this->header.closingSignature) { std::uint32_t fileOffset = this->fileOffset; - ReplayRecordHeader record{}; + ReplayRecordHeader record; int count = static_cast(this->header.records) - 1; if (count > 0) {