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.
This commit is contained in:
Misa
2020-08-14 01:47:56 -07:00
committed by Ethan Lee
parent 751e621c14
commit 7903b8967e

View File

@@ -147,7 +147,7 @@ int binaryBlob::getIndex(const char* _name)
{ {
for (size_t i = 0; i < SDL_arraysize(m_headers); i += 1) 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; return i;
} }