From: Uwe Bonnes Date: Sat, 10 Dec 2011 16:15:48 +0000 (+0100) Subject: Only call strtoul when there is an argument that strtoul can work on X-Git-Url: https://git.gag.com/?p=fw%2Fstlink;a=commitdiff_plain;h=2edd0530a6d3dfc428bedc3d9628093775673389 Only call strtoul when there is an argument that strtoul can work on --- diff --git a/flash/main.c b/flash/main.c index 8781941..39910b6 100644 --- a/flash/main.c +++ b/flash/main.c @@ -48,8 +48,8 @@ static int get_opts(struct opts* o, int ac, char** av) o->devname = av[1]; i = 1; } - - o->size = strtoul(av[i + 3], NULL, 16); + if (ac > 3) + o->size = strtoul(av[i + 3], NULL, 16); } else if (strcmp(av[0], "write") == 0) {