Skip to content

Commit c42a7ed

Browse files
committed
Check the input defensively
1 parent 07bcc59 commit c42a7ed

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)