From f3616a0857c558fd0ff566ca6dc5730599be9194 Mon Sep 17 00:00:00 2001 From: Bert Vermeulen Date: Thu, 2 Oct 2014 14:07:31 +0200 Subject: [PATCH] scpi/vxc: Avoid NULL dereference. This cleans up a warning generated by clang's static analyzer. --- src/scpi/scpi_vxi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; }