fix: skip invalid lines

This commit is contained in:
Sébastien Morais 2025-05-27 11:57:08 +02:00
parent 7ca5f46d06
commit 0addf15dbd

View file

@ -52,6 +52,10 @@ func getNonVirtualPackage(executor exec.Executor, name string) (pkg *AptPackage,
func getPackage(executor exec.Executor, paragraph string) (pkg *AptPackage, err error) { func getPackage(executor exec.Executor, paragraph string) (pkg *AptPackage, err error) {
errMsgs := []string{} errMsgs := []string{}
for _, splitLine := range GetSplitLines(paragraph, ":", 2) { for _, splitLine := range GetSplitLines(paragraph, ":", 2) {
if len(splitLine.Words) < 2 {
logging.Debug("Skipping invalid line: %+v\n", splitLine.Line)
continue
}
switch splitLine.Words[0] { switch splitLine.Words[0] {
case "Package": case "Package":
// Initialize since this will provide the first struct value if present. // Initialize since this will provide the first struct value if present.