fixed nil dereferencing

This commit is contained in:
yusing
2024-09-23 07:19:47 +08:00
parent daca4b7735
commit 6728bc39d2
2 changed files with 5 additions and 3 deletions

View File

@@ -60,10 +60,12 @@ func (b Builder) Build() NestedError {
}
func (b Builder) To(ptr *NestedError) {
if *ptr == nil {
if ptr == nil {
return
} else if *ptr == nil {
*ptr = b.Build()
} else {
**ptr = *b.Build()
(*ptr).With(b.Build())
}
}