Skip to content

Commit 2969dbe

Browse files
Merge pull request #50 from rayworks/parameter_validation
Check the input defensively
2 parents 07bcc59 + c42a7ed commit 2969dbe

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

0_hello_world.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ static void save_gray_frame(unsigned char *buf, int wrap, int xsize, int ysize,
2828

2929
int main(int argc, const char *argv[])
3030
{
31+
if (argc < 2) {
32+
printf("You need to specify a media file.\n");
33+
return -1;
34+
}
35+
3136
logging("initializing all the containers, codecs and protocols.");
3237

3338
// AVFormatContext holds the header information from the format (Container)

0 commit comments

Comments
 (0)