mirror of
https://github.com/langhuihui/monibuca.git
synced 2025-09-27 03:25:56 +08:00
fix(config): prevent panic by checking reflect.Value.IsValid() (#334)
This commit is contained in:
@@ -239,10 +239,15 @@ func (config *Config) ParseUserFile(conf map[string]any) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fv := prop.assign(k, v)
|
fv := prop.assign(k, v)
|
||||||
|
if fv.IsValid() {
|
||||||
prop.File = fv.Interface()
|
prop.File = fv.Interface()
|
||||||
if prop.Env == nil {
|
if prop.Env == nil {
|
||||||
prop.Ptr.Set(fv)
|
prop.Ptr.Set(fv)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// continue invalid field
|
||||||
|
slog.Error("Attempted to access invalid field during config parsing: %s", v)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user