fix: add random_loop_range validation in VideoItem
- Validate that random_loop_range values are positive - Validate that min <= max in random_loop_range - Prevents invalid config from causing runtime panics in rand::gen_range
This commit is contained in:
@@ -503,6 +503,15 @@ impl VideoItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some([min, max]) = self.random_loop_range {
|
||||||
|
if min <= 0 || max <= 0 {
|
||||||
|
bail!("{section}.random_loop_range 值必须大于 0");
|
||||||
|
}
|
||||||
|
if min > max {
|
||||||
|
bail!("{section}.random_loop_range[0] 不能大于 random_loop_range[1]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user