mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-11 05:06:51 +00:00
fix: panic when no multipart/alternative children
This commit is contained in:
@ -329,8 +329,12 @@ func bestChoice(childParts []parser.Parts, preferredContentType string) parser.P
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise, choose the last one.
|
||||
return childParts[len(childParts)-1]
|
||||
// Otherwise, choose the last one, if it exists.
|
||||
if len(childParts) > 0 {
|
||||
return childParts[len(childParts)-1]
|
||||
}
|
||||
|
||||
return parser.Parts{}
|
||||
}
|
||||
|
||||
func allPartsHaveContentType(parts parser.Parts, contentType string) bool {
|
||||
|
||||
Reference in New Issue
Block a user