]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
increment option incl zero
authorBastian Dehn <hhaalo@arcor.de>
Sun, 21 Jan 2024 18:54:19 +0000 (19:54 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 21 Jan 2024 18:54:19 +0000 (19:54 +0100)
src/kds_s2000w_handler.c

index 5e54d627a9777ad930ab0b4eae48cfaaca179e38..fce2096f803d1e42ec63b89f696312bb44286fa5 100644 (file)
@@ -54,11 +54,15 @@ void kds_s2000w_handler_get_option(int option, void* value)
        CURLcode result = curl_easy_perform(curl);
        curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &resp.code);
 
+       if (result != CURLE_OK || resp.code == 404)
+               return;
+
        json_object* resObj = json_tokener_parse(resp.data);
        json_object* config = json_object_object_get(resObj, "Configuration");
        int* num_options = (int*) value;
        *num_options = 0;
        *num_options = json_object_object_length(config);
+       *num_options++;
 
        curl_url_cleanup(url_handler);
        url_handler = NULL;