Fix the parsing error of PrefValue::Array, which is used for the parsing of Preferences shell_background_color_rgba field (#35865)

Signed-off-by: blycf <1355990831@qq.com>
This commit is contained in:
boluochoufeng 2025-03-10 23:16:11 +08:00 committed by GitHub
parent 52119c339c
commit 1200617683
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -43,8 +43,8 @@ impl TryFrom<&Value> for PrefValue {
.unwrap_or(Err("Could not parse number from JSON".into())),
Value::String(value) => Ok(value.clone().into()),
Value::Array(array) => {
let mut array = array.iter().map(TryInto::try_into);
if !array.all(|v| v.is_ok()) {
let array = array.iter().map(TryInto::try_into);
if !array.clone().all(|v| v.is_ok()) {
return Err(format!(
"Cannot turn all array avlues into preference: {array:?}"
));