From: Bert Vermeulen Date: Thu, 2 Oct 2014 12:07:31 +0000 (+0200) Subject: scpi/vxc: Avoid NULL dereference. X-Git-Tag: libsigrok-0.4.0~903 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f3616a0857c558fd0ff566ca6dc5730599be9194;p=libsigrok.git scpi/vxc: Avoid NULL dereference. This cleans up a warning generated by clang's static analyzer. --- diff --git a/src/scpi/scpi_vxi.c b/src/scpi/scpi_vxi.c index 271917b0..62bf8c61 100644 --- a/src/scpi/scpi_vxi.c +++ b/src/scpi/scpi_vxi.c @@ -133,7 +133,7 @@ static int scpi_vxi_send(void *priv, const char *command) if (!(write_resp = device_write_1(&write_parms, vxi->client)) || write_resp->error) { sr_err("Device write failed for %s with error %d", - vxi->address, write_resp->error); + vxi->address, write_resp ? write_resp->error : 0); return SR_ERR; } @@ -178,7 +178,7 @@ static int scpi_vxi_read_data(void *priv, char *buf, int maxlen) if (!(read_resp = device_read_1(&read_parms, vxi->client)) || read_resp->error) { sr_err("Device read failed for %s with error %d", - vxi->address, read_resp->error); + vxi->address, read_resp ? read_resp->error : 0); return SR_ERR; }