summaryrefslogtreecommitdiff
path: root/runtime/jdwp/jdwp_expand_buf.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/jdwp/jdwp_expand_buf.cc')
-rw-r--r--runtime/jdwp/jdwp_expand_buf.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/jdwp/jdwp_expand_buf.cc b/runtime/jdwp/jdwp_expand_buf.cc
index e492d7eb26..961dd369c8 100644
--- a/runtime/jdwp/jdwp_expand_buf.cc
+++ b/runtime/jdwp/jdwp_expand_buf.cc
@@ -164,7 +164,7 @@ static void SetUtf8String(uint8_t* buf, const char* str, size_t strLen) {
* have stored null bytes in a multi-byte encoding).
*/
void expandBufAddUtf8String(ExpandBuf* pBuf, const char* s) {
- int strLen = strlen(s);
+ int strLen = (s != nullptr ? strlen(s) : 0);
ensureSpace(pBuf, sizeof(uint32_t) + strLen);
SetUtf8String(pBuf->storage + pBuf->curLen, s, strLen);
pBuf->curLen += sizeof(uint32_t) + strLen;