prevent panic if you use API in a wrong way
Upstream-commit: 49d7b87cfc4385470a5ecf181f92c13b8391c002 Component: engine
This commit is contained in:
@ -133,7 +133,11 @@ type PortBinding struct {
|
||||
type Port string
|
||||
|
||||
func (p Port) Proto() string {
|
||||
return strings.Split(string(p), "/")[1]
|
||||
parts := strings.Split(string(p), "/")
|
||||
if len(parts) == 1 {
|
||||
return "tcp"
|
||||
}
|
||||
return parts[1]
|
||||
}
|
||||
|
||||
func (p Port) Port() string {
|
||||
|
||||
Reference in New Issue
Block a user