mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 12:46:46 +00:00
fix: panic when no multipart/alternative children
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2020 Proton Technologies AG
|
||||
// Copyright (c) 2021 Proton Technologies AG
|
||||
//
|
||||
// This file is part of ProtonMail Bridge.
|
||||
//
|
||||
|
||||
@ -329,10 +329,14 @@ func bestChoice(childParts []parser.Parts, preferredContentType string) parser.P
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise, choose the last one.
|
||||
// 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 {
|
||||
if len(parts) == 0 {
|
||||
return false
|
||||
|
||||
@ -9,3 +9,6 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
|
||||
### Removed
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
* GODT-979 Fix panic when trying to parse a multipart/alternative section that has no child sections.
|
||||
|
||||
Reference in New Issue
Block a user