Check for error

FossilOrigin-Name: f006d7df58bb3a566f956dddc2ae79493758b422afea5dee3da8982e15c2de4a
This commit is contained in:
me@ow.nekobit.net 2022-03-29 19:33:49 +00:00
parent 15fa13b86c
commit 2c509d650c
3 changed files with 4 additions and 3 deletions

View file

@ -33,7 +33,7 @@ int _mstdnt_key_val_ref(cJSON* v, struct _mstdnt_val_ref* refs,
size_t i;
for (i = 0; i < refs_len; ++i)
{
if (strcmp(refs[i].key, v->string) == 0)
if (v->string && strcmp(refs[i].key, v->string) == 0)
{
refs[i].handle(v, refs[i].val);
return 0;

View file

@ -42,13 +42,11 @@ int mastodont_request(mastodont_t* data, struct mastodont_request_args* args)
goto cleanup;
}
/*
if (mstdnt_check_error(&results, storage))
{
res = 1;
goto cleanup_res;
}
*/
/* Optional */
if (args->callback) args->callback(&results, storage, args->args);

View file

@ -85,6 +85,9 @@ int mstdnt_status_from_result(struct mstdnt_fetch_results* results,
struct mstdnt_storage* storage,
struct mstdnt_status* status)
{
/* Can be null sometimes */
if (!status) return 0;
cJSON* root;
if (_mstdnt_json_init(&root, results, storage) ||
!cJSON_IsObject(root))