mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-25 04:22:00 -08:00
confenv: fix possible crash
This commit is contained in:
parent
e724c3ba1e
commit
14efc103ba
1 changed files with 7 additions and 3 deletions
|
|
@ -70,12 +70,16 @@ func process(env map[string]string, envKey string, rv reflect.Value) error {
|
|||
|
||||
case reflect.Map:
|
||||
for k := range env {
|
||||
if !strings.HasPrefix(k, envKey) {
|
||||
if !strings.HasPrefix(k, envKey+"_") {
|
||||
continue
|
||||
}
|
||||
|
||||
tmp := strings.Split(strings.TrimPrefix(k[len(envKey):], "_"), "_")
|
||||
mapKey := strings.ToLower(tmp[0])
|
||||
tmp := strings.Split(k[len(envKey+"_"):], "_")
|
||||
mapKey := tmp[0]
|
||||
if len(mapKey) == 0 {
|
||||
continue
|
||||
}
|
||||
mapKey = strings.ToLower(mapKey)
|
||||
|
||||
nv := rv.MapIndex(reflect.ValueOf(mapKey))
|
||||
zero := reflect.Value{}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue