prevent panic if you use API in a wrong way
This commit is contained in:
parent
f417c4b099
commit
49d7b87cfc
1 changed files with 5 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue