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:
Burkov Egor
2025-02-07 02:46:26 -08:00
committed by GitHub
parent 6376279f15
commit 030c8125eb
+2 -2
View File
@@ -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
}