fix: urls equals nil deref (#5126)
Now in checks we can get nil dereference while both struct has Content
field of nil. But in code we cheching for nil, and I believe that
testcase can be real:
```go
urls1 := URLs{};
urls2 := URLs{};
urls1.Equal(urls2);
```
This commit is contained in:
+2
-2
@@ -50,7 +50,7 @@ func (m URLs) Equal(n URLs) bool {
|
||||
return false
|
||||
} else if m.SourceContent == nil && n.SourceContent != nil {
|
||||
return false
|
||||
} else if m.SourceContent.URL != n.SourceContent.URL {
|
||||
} else if m.SourceContent != nil && n.SourceContent != nil && m.SourceContent.URL != n.SourceContent.URL {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ func (m URLs) Equal(n URLs) bool {
|
||||
return false
|
||||
} else if m.TargetContent == nil && n.TargetContent != nil {
|
||||
return false
|
||||
} else if m.TargetContent.URL != n.TargetContent.URL {
|
||||
} else if m.TargetContent != nil && n.TargetContent != nil && m.TargetContent.URL != n.TargetContent.URL {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user