Skip to content

Commit 9214b44

Browse files
committed
video/out/win_state: don't allow apply_autofit to return 0
There's no way this coordinate can ever work so don't force callers to waste time checking for it, so just MPMAX at 1. Fixes a crash in certain cases if you do --autofit=1x1.
1 parent 90985bb commit 9214b44

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

video/out/win_state.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ static void apply_autofit(int *w, int *h, int scr_w, int scr_h,
5757
double n_asp = (double)n_w / n_h;
5858
if ((n_asp <= asp) == allow_down) {
5959
*w = n_w;
60-
*h = n_w / asp;
60+
*h = MPMAX(n_w / asp, 1);
6161
} else {
62-
*w = n_h * asp;
62+
*w = MPMAX(n_h * asp, 1);
6363
*h = n_h;
6464
}
6565
}

0 commit comments

Comments
 (0)