btrfs-progs: check for null string in parse_size

Because it's better than a segfault if it's called improperly,
and it makes static checkers happier.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
This commit is contained in:
Eric Sandeen 2013-03-04 16:39:56 -06:00 committed by David Sterba
parent dd53ec1c12
commit 1b18ff60b1
1 changed files with 1 additions and 1 deletions

View File

@ -1382,7 +1382,7 @@ u64 parse_size(char *s)
char c;
u64 mult = 1;
for (i=0 ; s[i] && isdigit(s[i]) ; i++) ;
for (i = 0; s && s[i] && isdigit(s[i]); i++) ;
if (!i) {
fprintf(stderr, "ERROR: size value is empty\n");
exit(50);