aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-21 11:51:34 -0800
committerChris Robinson <[email protected]>2018-11-21 11:51:34 -0800
commitdfcc98afbf574205e11826753f0a2c2abc7b922e (patch)
tree5b1f1290b5efe444d74f87d9c56b151c025d2fde /OpenAL32
parentd20522166ec8adf856a5ba4c99ee45ea733ca8b4 (diff)
Fix deleting the same buffer ID multiple times in one call
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/alBuffer.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/OpenAL32/alBuffer.cpp b/OpenAL32/alBuffer.cpp
index b08518ba..196dcd22 100644
--- a/OpenAL32/alBuffer.cpp
+++ b/OpenAL32/alBuffer.cpp
@@ -502,7 +502,10 @@ AL_API ALvoid AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers)
/* All good. Delete non-0 buffer IDs. */
std::for_each(buffers, buffers_end,
[device](ALuint bid) -> void
- { if(bid) FreeBuffer(device, LookupBuffer(device, bid)); }
+ {
+ ALbuffer *buffer{bid ? LookupBuffer(device, bid) : nullptr};
+ if(buffer) FreeBuffer(device, buffer);
+ }
);
}
}