]> sigrok.org Git - libsigrok.git/commitdiff
scpi/vxc: Avoid NULL dereference.
authorBert Vermeulen <redacted>
Thu, 2 Oct 2014 12:07:31 +0000 (14:07 +0200)
committerBert Vermeulen <redacted>
Thu, 2 Oct 2014 12:07:31 +0000 (14:07 +0200)
This cleans up a warning generated by clang's static analyzer.

src/scpi/scpi_vxi.c

index 271917b082dfedeaab67419d581e8806eecd9844..62bf8c61bcdab6d9ea6c4582fed60c272318e086 100644 (file)
@@ -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;
        }