From fa0697e887b383a970d726513ae804bccb7630c0 Mon Sep 17 00:00:00 2001 From: Simon Wilson Date: Tue, 9 Aug 2011 16:22:40 -0700 Subject: tinyplay: fix segfault caused by missing device argument --- tinyplay.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tinyplay.c') diff --git a/tinyplay.c b/tinyplay.c index f52d76a..915a1ea 100644 --- a/tinyplay.c +++ b/tinyplay.c @@ -76,9 +76,12 @@ int main(int argc, char **argv) /* parse command line arguments */ argv += 2; - if (strcmp(*argv, "-d") == 0) { + while (*argv) { + if (strcmp(*argv, "-d") == 0) { + argv++; + device = atoi(*argv); + } argv++; - device = atoi(*argv); } fread(&header, sizeof(struct wav_header), 1, file); -- cgit v1.2.3