From 7903b8967ea98e44330fa88056176b60244ed933 Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 14 Aug 2020 01:47:56 -0700 Subject: [PATCH] Check `valid` in binaryBlob::getIndex() The binary blob shouldn't return an index if it ends up being invalid. That could cause a whole lot of issues if musicclass ends up parsing the resulting struct. With all that said, though, musicclass doesn't check the -1 sentinel value anyway, even though it should, but that'll be fixed later. --- desktop_version/src/BinaryBlob.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop_version/src/BinaryBlob.cpp b/desktop_version/src/BinaryBlob.cpp index 1f52304d..1ddea512 100644 --- a/desktop_version/src/BinaryBlob.cpp +++ b/desktop_version/src/BinaryBlob.cpp @@ -147,7 +147,7 @@ int binaryBlob::getIndex(const char* _name) { for (size_t i = 0; i < SDL_arraysize(m_headers); i += 1) { - if (strcmp(_name, m_headers[i].name) == 0) + if (strcmp(_name, m_headers[i].name) == 0 && m_headers[i].valid) { return i; }