diff --git a/src/magic.c b/src/magic.c index d65685aff..20fd47ccd 100644 --- a/src/magic.c +++ b/src/magic.c @@ -2985,6 +2985,8 @@ spellbook * get_spellbook(const char * name) log_error("cb_insert failed although cb_find returned nothing for spellbook=%s", name); assert(!"should not happen"); } + cb_find_prefix(&cb_spellbooks, name, strlen(name), &match, 1, 0); + cb_get_kv(match, &result, sizeof(result)); } return result; } diff --git a/src/magic.test.c b/src/magic.test.c index f356fa686..b208836f9 100644 --- a/src/magic.test.c +++ b/src/magic.test.c @@ -53,8 +53,9 @@ void test_spellbooks(CuTest * tc) test_cleanup(); herp = get_spellbook("herp"); - derp = get_spellbook("derp"); CuAssertPtrNotNull(tc, herp); + CuAssertPtrEquals(tc, herp, get_spellbook("herp")); + derp = get_spellbook("derp"); CuAssertPtrNotNull(tc, derp); CuAssertTrue(tc, derp != herp); CuAssertStrEquals(tc, "herp", herp->name);