Skip to content

Commit 849929b

Browse files
committed
vo_pp/split: fix crash when no args given
1 parent bc05c72 commit 849929b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/vo_postprocess/split.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @author Martin Pulec <[email protected]>
44
*/
55
/*
6-
* Copyright (c) 2011-2023 CESNET, z. s. p. o.
6+
* Copyright (c) 2011-2025 CESNET, zájmové sdružení právnických osob
77
* All rights reserved.
88
*
99
* Redistribution and use in source and binary forms, with or without
@@ -50,6 +50,8 @@
5050
#include <pthread.h>
5151
#include <stdlib.h>
5252

53+
#define MOD_NAME "[split] "
54+
5355
struct state_split {
5456
struct video_frame *in;
5557
int grid_width, grid_height;
@@ -75,6 +77,7 @@ static bool split_get_property(void *state, int property, void *val, size_t *len
7577

7678
static void usage()
7779
{
80+
printf("usage:\n");
7881
printf("-p split:<X>:<Y>\n");
7982
printf("\tsplit to XxY tiles\n");
8083
}
@@ -94,9 +97,12 @@ static void * split_init(const char *config) {
9497
assert(tmp != NULL);
9598

9699
item = strtok_r(tmp, ":", &save_ptr);
97-
s->grid_width = atoi(item);
98-
item = strtok_r(NULL, ":", &save_ptr);
100+
if (item != NULL) {
101+
s->grid_width = atoi(item);
102+
item = strtok_r(NULL, ":", &save_ptr);
103+
}
99104
if(!item) {
105+
MSG(ERROR, "Wrong usage!\n");
100106
usage();
101107
free(s);
102108
free(tmp);

0 commit comments

Comments
 (0)