llama : llama_chat_apply_template support null buf

This commit is contained in:
Georgi Gerganov 2024-03-05 17:23:18 +02:00
parent 7635b13ad7
commit f84809b7ad
No known key found for this signature in database
GPG key ID: BF970631944C16B7

View file

@ -13544,7 +13544,9 @@ LLAMA_API int32_t llama_chat_apply_template(
if (res < 0) { if (res < 0) {
return res; return res;
} }
strncpy(buf, formatted_chat.c_str(), length); if (buf && length > 0) {
strncpy(buf, formatted_chat.c_str(), length);
}
return res; return res;
} }