diff options
Diffstat (limited to 'al/debug.cpp')
-rw-r--r-- | al/debug.cpp | 11 |
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(); |