mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-16 07:06:45 +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.
|
// This file is part of ProtonMail Bridge.
|
||||||
//
|
//
|
||||||
|
|||||||
@ -329,8 +329,12 @@ 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 childParts[len(childParts)-1]
|
||||||
|
}
|
||||||
|
|
||||||
|
return parser.Parts{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func allPartsHaveContentType(parts parser.Parts, contentType string) bool {
|
func allPartsHaveContentType(parts parser.Parts, contentType string) bool {
|
||||||
|
|||||||
@ -9,3 +9,6 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
|
|||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
### Changed
|
### 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