Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
int r;
// Parse the API response
- switch (code) {
- case PAKFIRE_XFER_OK:
- r = pakfire_json_parse(&response, &error, self->output.buffer, self->output.length);
- if (r < 0) {
- ERROR(self->ctx, "Failed to parse JSON response: %s\n", error);
- goto ERROR;
- }
- break;
+ if (self->output.length) {
+ switch (code) {
+ case PAKFIRE_XFER_OK:
+ r = pakfire_json_parse(&response, &error, self->output.buffer, self->output.length);
+ if (r < 0) {
+ ERROR(self->ctx, "Failed to parse JSON response: %s\n", error);
+ goto ERROR;
+ }
+ break;
- default:
- break;
+ default:
+ break;
+ }
}
// Run the callback