diff --git a/Common/Render/DrawBuffer.h b/Common/Render/DrawBuffer.h index c73abae598..94e5e56095 100644 --- a/Common/Render/DrawBuffer.h +++ b/Common/Render/DrawBuffer.h @@ -89,6 +89,11 @@ public: void V(float x, float y, float z, uint32_t color, float u, float v) { _dbg_assert_msg_(count_ < MAX_VERTS, "Overflowed the DrawBuffer"); + if (count_ >= MAX_VERTS) { + // _dbg_assert_msg_ above is compiled out in release builds - don't write + // past the end of verts_ there either, just drop the vertex. + return; + } #ifdef _DEBUG if (my_isnanorinf(x) || my_isnanorinf(y) || my_isnanorinf(z)) { diff --git a/Common/Render/ManagedTexture.cpp b/Common/Render/ManagedTexture.cpp index bc36a2aca5..ef4a46ddc1 100644 --- a/Common/Render/ManagedTexture.cpp +++ b/Common/Render/ManagedTexture.cpp @@ -40,13 +40,9 @@ public: return; } - if (!tempImage_->LoadTextureLevelsFromFileData(buffer, fileSize, type_)) { - *state_ = ManagedTexture::LoadState::FAILED; - waitable_->Notify(); - return; - } + bool success = tempImage_->LoadTextureLevelsFromFileData(buffer, fileSize, type_); delete[] buffer; - *state_ = ManagedTexture::LoadState::SUCCESS; + *state_ = success ? ManagedTexture::LoadState::SUCCESS : ManagedTexture::LoadState::FAILED; waitable_->Notify(); }