From: Olaf Wintermann Date: Tue, 25 Nov 2025 18:22:04 +0000 (+0100) Subject: fix json rpc error handling X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;p=uwplayer.git fix json rpc error handling --- diff --git a/application/player.c b/application/player.c index 97aec86..171fafa 100644 --- a/application/player.c +++ b/application/player.c @@ -329,7 +329,7 @@ static void player_io(Player *p) { cxJsonValueFree(value); } - if(ret == -1) { + if(ret > CX_JSON_OK) { fprintf(stderr, "JSON-RPC error\n"); break; } diff --git a/application/settings.c b/application/settings.c index e66a959..d725ef4 100644 --- a/application/settings.c +++ b/application/settings.c @@ -135,8 +135,8 @@ int load_config(void) { cxJsonFilln(&parser, buf, r); } while((ret = cxJsonNext(&parser, &value)) != CX_JSON_NO_ERROR); - if(ret > CX_JSON_NULL_DATA) { - fprintf(stderr, "Error: cannot parse config file: %s\n", cfgfile_path); + if(ret == CX_JSON_NULL_DATA) { + ret = 0; } else if(value) { if(value->type == CX_JSON_OBJECT) { ret = 0; @@ -145,6 +145,8 @@ int load_config(void) { } else { ret = 1; } + } else if(ret > CX_JSON_NULL_DATA) { + fprintf(stderr, "Error: cannot parse config file: %s\n", cfgfile_path); } cxJsonDestroy(&parser);