mirror of
https://github.com/switchbrew/switch-tools.git
synced 2025-06-27 07:52:40 +02:00
Allow service_host and service_access to be NULL.
Fixes compatibility with old-style JSON, and is more flexible anyways.
This commit is contained in:
parent
ed43910d46
commit
2f017c4ba7
@ -387,7 +387,7 @@ int CreateNpdm(const char *json, void **dst, u32 *dst_size) {
|
|||||||
u32 sac_size = 0;
|
u32 sac_size = 0;
|
||||||
|
|
||||||
services = cJSON_GetObjectItemCaseSensitive(npdm_json, "service_host");
|
services = cJSON_GetObjectItemCaseSensitive(npdm_json, "service_host");
|
||||||
if (!cJSON_IsArray(services)) {
|
if (services != NULL && !cJSON_IsArray(services)) {
|
||||||
fprintf(stderr, "Service Host must be an array!\n");
|
fprintf(stderr, "Service Host must be an array!\n");
|
||||||
status = 0;
|
status = 0;
|
||||||
goto NPDM_BUILD_END;
|
goto NPDM_BUILD_END;
|
||||||
@ -420,14 +420,14 @@ int CreateNpdm(const char *json, void **dst, u32 *dst_size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
services = cJSON_GetObjectItemCaseSensitive(npdm_json, "service_access");
|
services = cJSON_GetObjectItemCaseSensitive(npdm_json, "service_access");
|
||||||
if (!(cJSON_IsObject(services) || cJSON_IsArray(services))) {
|
if (!(services == NULL || cJSON_IsObject(services) || cJSON_IsArray(services))) {
|
||||||
fprintf(stderr, "Service Access must be an array!\n");
|
fprintf(stderr, "Service Access must be an array!\n");
|
||||||
status = 0;
|
status = 0;
|
||||||
goto NPDM_BUILD_END;
|
goto NPDM_BUILD_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sac_obj = 0;
|
int sac_obj = 0;
|
||||||
if (cJSON_IsObject(services)) {
|
if (services != NULL && cJSON_IsObject(services)) {
|
||||||
sac_obj = 1;
|
sac_obj = 1;
|
||||||
fprintf(stderr, "Using deprecated service_access format. Please turn it into an array.\n");
|
fprintf(stderr, "Using deprecated service_access format. Please turn it into an array.\n");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user