aboutsummaryrefslogtreecommitdiffstats
path: root/al
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-05-03 07:44:10 -0700
committerChris Robinson <[email protected]>2023-05-03 07:44:10 -0700
commit90b0840d62a123e946e81f514bbe331897da8838 (patch)
treed71b8566615935a911e44277e75a2972f0d2d0fc /al
parent4739b77b8a20800b24b6187dca9aedca5fac367b (diff)
Ignore logBufSize if logBuf is null
Diffstat (limited to 'al')
-rw-r--r--al/debug.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/al/debug.cpp b/al/debug.cpp
index f584da99..fa16ff73 100644
--- a/al/debug.cpp
+++ b/al/debug.cpp
@@ -467,16 +467,19 @@ FORCE_ALIGN ALuint AL_APIENTRY alGetDebugMessageLogEXT(ALuint count, ALsizei log
auto &entry = context->mDebugLog.front();
const size_t tocopy{entry.mMessage.size() + 1};
- const size_t avail{static_cast<ALuint>(logBufSize - logBufWritten)};
- if(avail < tocopy)
- return i;
+ if(logBuf)
+ {
+ const size_t avail{static_cast<ALuint>(logBufSize - logBufWritten)};
+ if(avail < tocopy)
+ return i;
+ std::copy_n(entry.mMessage.data(), tocopy, logBuf+logBufWritten);
+ }
if(sources) sources[i] = GetDebugSourceEnum(entry.mSource);
if(types) types[i] = GetDebugTypeEnum(entry.mType);
if(ids) ids[i] = entry.mId;
if(severities) severities[i] = GetDebugSeverityEnum(entry.mSeverity);
if(lengths) lengths[i] = static_cast<ALsizei>(tocopy);
- if(logBuf) std::copy_n(entry.mMessage.data(), tocopy, logBuf+logBufWritten);
logBufWritten += static_cast<ALsizei>(tocopy);
context->mDebugLog.pop_front();