Commit a779799
authored
fix(useVideoEditor): guard validateRecipe and localStorage against NaN dimensions (magic-peach#894)
NaN comparisons (NaN < 16, NaN > 7680) always evaluate to false, so a
customWidth or customHeight that is NaN passes all boundary checks and
validateRecipe returns null (no error). The NaN then propagates to the
FFmpeg scale filter as scale=NaN:NaN, crashing the export immediately.
Two fixes applied:
1. validateRecipe: prefix each custom-dimension check with Number.isNaN()
so a NaN value is caught as a validation error before any comparison.
2. Legacy localStorage parser: replace bare nullish-coalescing on
parsed.customWidth/customHeight with a sanitizeDimension helper that
calls Number.isFinite() and enforces the [16, 7680] range. Any
corrupted, non-numeric, or out-of-range stored value falls back to the
previous safe default instead of being merged into state as NaN.
Closes magic-peach#8641 parent 5b24c5f commit a779799
1 file changed
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| |||
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
251 | 255 | | |
252 | 256 | | |
253 | 257 | | |
254 | 258 | | |
255 | 259 | | |
256 | | - | |
257 | | - | |
| 260 | + | |
| 261 | + | |
258 | 262 | | |
259 | 263 | | |
260 | 264 | | |
| |||
0 commit comments