Fix: nil pointer
This commit is contained in:
parent
4ca2d4146b
commit
02933ae568
2 changed files with 5 additions and 3 deletions
|
@ -127,9 +127,9 @@ func (m *Metadata) SourceDetail() string {
|
||||||
return fmt.Sprintf("[%s]", ClashName)
|
return fmt.Sprintf("[%s]", ClashName)
|
||||||
}
|
}
|
||||||
|
|
||||||
if m.Process != "" && *m.Uid != -1 {
|
if m.Process != "" && m.Uid != nil {
|
||||||
return fmt.Sprintf("%s(%s, uid=%d)", m.SourceAddress(), m.Process, *m.Uid)
|
return fmt.Sprintf("%s(%s, uid=%d)", m.SourceAddress(), m.Process, *m.Uid)
|
||||||
} else if *m.Uid != -1 {
|
} else if m.Uid != nil {
|
||||||
return fmt.Sprintf("%s(uid=%d)", m.SourceAddress(), *m.Uid)
|
return fmt.Sprintf("%s(uid=%d)", m.SourceAddress(), *m.Uid)
|
||||||
} else if m.Process != "" {
|
} else if m.Process != "" {
|
||||||
return fmt.Sprintf("%s(%s)", m.SourceAddress(), m.Process)
|
return fmt.Sprintf("%s(%s)", m.SourceAddress(), m.Process)
|
||||||
|
|
|
@ -403,7 +403,9 @@ func match(metadata *C.Metadata) (C.Proxy, C.Rule, error) {
|
||||||
} else {
|
} else {
|
||||||
metadata.Process = filepath.Base(path)
|
metadata.Process = filepath.Base(path)
|
||||||
metadata.ProcessPath = path
|
metadata.ProcessPath = path
|
||||||
metadata.Uid = &uid
|
if uid != -1 {
|
||||||
|
metadata.Uid = &uid
|
||||||
|
}
|
||||||
processFound = true
|
processFound = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue