CID 32303 Unchecked return value

appeasing coverity
This commit is contained in:
Enno Rehling 2015-11-09 20:03:38 +01:00
parent 32c777d428
commit 66e43caf9d

View file

@ -2978,7 +2978,7 @@ spellbook * get_spellbook(const char * name)
spellbook * result; spellbook * result;
void * match; void * match;
if (cb_find_prefix(&cb_spellbooks, name, strlen(name), &match, 1, 0)) { if (cb_find_prefix(&cb_spellbooks, name, strlen(name), &match, 1, 0) > 0) {
cb_get_kv(match, &result, sizeof(result)); cb_get_kv(match, &result, sizeof(result));
} }
else { else {
@ -2990,8 +2990,10 @@ spellbook * get_spellbook(const char * name)
log_error("cb_insert failed although cb_find returned nothing for spellbook=%s", name); log_error("cb_insert failed although cb_find returned nothing for spellbook=%s", name);
assert(!"should not happen"); assert(!"should not happen");
} }
cb_find_prefix(&cb_spellbooks, name, strlen(name), &match, 1, 0); result = 0;
cb_get_kv(match, &result, sizeof(result)); if (cb_find_prefix(&cb_spellbooks, name, strlen(name), &match, 1, 0) > 0) {
cb_get_kv(match, &result, sizeof(result));
}
} }
return result; return result;
} }