]> sigrok.org Git - libsigrok.git/commitdiff
sr_parse_sizestring: Deal with invalid strings better.
authorBert Vermeulen <redacted>
Thu, 2 Oct 2014 10:57:19 +0000 (12:57 +0200)
committerBert Vermeulen <redacted>
Thu, 2 Oct 2014 10:57:19 +0000 (12:57 +0200)
This cleans up a warning generated by clang's static analyzer.

src/strutil.c

index 54dc1f39df50123ac985a158bc3d9ca425f9f5a6..0306ea7c91f940002861e2ce114654e6a82b0b39 100644 (file)
@@ -426,7 +426,7 @@ SR_API int sr_parse_sizestring(const char *sizestring, uint64_t *size)
        } else
                *size += frac_part;
 
-       if (*s && strcasecmp(s, "Hz"))
+       if (s && *s && strcasecmp(s, "Hz"))
                return SR_ERR;
 
        return SR_OK;