mirror of
https://github.com/vishvananda/netlink
synced 2025-03-04 04:17:59 +00:00
protinfo: Check if object is nil
Avoid segfaults in certain environments by checking if the Stringer interface pointer receiver function is `nil` and return "<nil>" in those scenarios. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
parent
a06dabf159
commit
d77c86a2e2
@ -18,6 +18,10 @@ type Protinfo struct {
|
||||
|
||||
// String returns a list of enabled flags
|
||||
func (prot *Protinfo) String() string {
|
||||
if prot == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
|
||||
var boolStrings []string
|
||||
if prot.Hairpin {
|
||||
boolStrings = append(boolStrings, "Hairpin")
|
||||
|
Loading…
Reference in New Issue
Block a user