Silence coverity CHECKED_RETURN writing benc strs

saveStringFunc() gets the target string by calling tr_variantGetStr().
It previously didn't check to see if this function succeeded because
saveStringFunc() isn't reached without the type already being known.
However, checking the return value costs nothing and makes Coverity happy.
This commit is contained in:
Charles Kerr 2019-02-17 10:24:31 +00:00
parent f79e22fb90
commit 33e2ece7e5
1 changed files with 5 additions and 3 deletions

View File

@ -351,9 +351,11 @@ static void saveStringFunc(tr_variant const* v, void* evbuf)
{
size_t len;
char const* str;
tr_variantGetStr(v, &str, &len);
evbuffer_add_printf(evbuf, "%zu:", len);
evbuffer_add(evbuf, str, len);
if (tr_variantGetStr(v, &str, &len))
{
evbuffer_add_printf(evbuf, "%zu:", len);
evbuffer_add(evbuf, str, len);
}
}
static void saveDictBeginFunc(tr_variant const* val UNUSED, void* evbuf)