diff --git a/src/kernel/save.test.c b/src/kernel/save.test.c index fd8ff48ea..403eaa059 100644 --- a/src/kernel/save.test.c +++ b/src/kernel/save.test.c @@ -38,6 +38,7 @@ static void test_readwrite_unit(CuTest * tc) f = test_create_faction(0); fno = f->no; u = test_create_unit(f, r); + _mkdir(datapath()); sprintf(path, "%s/%s", datapath(), filename); data = gamedata_open(path, "wb"); diff --git a/src/kernel/spell.c b/src/kernel/spell.c index 05e1ab8e8..ebd5d44ef 100644 --- a/src/kernel/spell.c +++ b/src/kernel/spell.c @@ -73,7 +73,7 @@ spell * create_spell(const char * name, unsigned int id) } sp = (spell *)calloc(1, sizeof(spell)); len = cb_new_kv(name, len, &sp, sizeof(sp), buffer); - if (cb_insert(&cb_spells, buffer, len)) { + if (cb_insert(&cb_spells, buffer, len) == CB_SUCCESS) { sp->id = id ? id : hashstring(name); sp->sname = _strdup(name); add_spell(&spells, sp);