]> uap-core.de Git - uwplayer.git/commitdiff
fix json rpc error handling default
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Tue, 25 Nov 2025 18:22:04 +0000 (19:22 +0100)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Tue, 25 Nov 2025 18:22:04 +0000 (19:22 +0100)
application/player.c
application/settings.c

index 97aec86e39863b58f8b25ec401814afc34dbd36e..171fafadca5b12f2898c9b31bd464df11ce7347e 100644 (file)
@@ -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;
             }
index e66a959d8f6d67bf2278ffcdadb37f3180647f25..d725ef4543da688f85742f760404b6a07185444b 100644 (file)
@@ -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);