summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2018-11-30 16:06:49 -0500
committerSubv <subv2112@gmail.com>2018-11-30 16:06:49 -0500
commit583bd20f02fabb2b41f42d2ae8feb1994c0e4fb4 (patch)
treef1bafdba579c4f930828f51df717d56c62d3d7a8 /src
parent4b950728fd0a8ca1d970ed697421d77d84296e82 (diff)
Services/VI: Dereferencing an uninitialized std::optional is undefined behavior.
Assert that it is not empty before using it in the DequeueBuffer wait callback.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/vi/vi.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index 5120abfff..412d5b0c9 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -542,6 +542,8 @@ private:
// Repeat TransactParcel DequeueBuffer when a buffer is available
auto buffer_queue = nv_flinger->GetBufferQueue(id);
std::optional<u32> slot = buffer_queue->DequeueBuffer(width, height);
+ ASSERT_MSG(slot != std::nullopt, "Could not dequeue buffer.");
+
IGBPDequeueBufferResponseParcel response{*slot};
ctx.WriteBuffer(response.Serialize());
IPC::ResponseBuilder rb{ctx, 2};